Distance Calculator (2D). Enter the coordinates of two points — Point 1 (x1, y1) and Point 2 (x2, y2) — and the Distance Calculator (2D) computes the straight-line Euclidean distance between them on a 2D plane. You also get the Δx and Δy component differences, giving you a full picture of the separation between your two points. Also try the Midpoint Calculator.
Use the Distance Calculator (2D) when you have two locations on a flat surface and want the gap between them. Type an x and a y value for each end to get the Euclidean distance: the direct measurement from one spot to the other. Beyond the distance between two points, the same four inputs also give you the centre point and the direction of travel.
2D distance formula for two points on a Cartesian coordinate system
In a Cartesian coordinate system, every location has an address made of x-y coordinates: how far across, then how far up. Call the first point (x1, y1) and the second (x2, y2). In this two-dimensional plane, the gap between them is:
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
The result d is the length of the line segment that joins both ends. Because a straight line is the shortest path across flat ground, no other route between those addresses can be shorter. In geometry, you measure between exact positions.
Pythagorean theorem and the square root step
The equation is the Pythagorean theorem in disguise. Draw a horizontal run from the first location and a vertical rise to the second, and you have built one of the right triangles you met in school. The run is one side, the rise is the other, and d is the hypotenuse.
The sum of squares, \(\Delta x^2 + \Delta y^2\), equals the distance squared.
Taking the square root turns that total back into a plain measurement.
Both differences are squared, so the order of the two points never changes the answer, and the result is always non-negative.
Each squared gap's share of the total.
How to find the shortest distance with this tool
A distance between two points calculator takes four numbers. This free distance calculator 2D version works as a distance calculator online for any 2D plane.
Enter x1 and y1 for the start point.
Enter x2 and y2 for the end point.
Keep every value in the same unit.
Click the Calculate button.
A good distance calculator between two points shows the work step-by-step, including where you plug the values into the equation.
Coordinate points you can enter
Your coordinate points can include negative numbers and decimals. Convert fractions first, for example 7/8 to 0.875, if a field accepts only decimal input.
Distance Calculator (2D) worked example
Suppose you plot A at (−6, 2.5) and B at (8.4, −7.1). Subtract start from end, square each gap, add them, then take the root. The tool follows the same sequence in this worked example:
Step
Working
Value
Horizontal change, Δx
8.4 − (−6)
14.4
Vertical change, Δy
−7.1 − 2.5
−9.6
Square Δx
14.4²
207.36
Square Δy
(−9.6)²
92.16
Add the squares
207.36 + 92.16
299.52
Take the root
√299.52
17.31
You can sanity-check the output against a quick graph. The diagonal distance of 17.31 must be longer than the larger gap (14.4) and shorter than both gaps added together (24). If your figure falls outside that window, one of the inputs or signs is off. With any distance between two points calculator, this check catches most typing slips.Run, rise and direct segment.
Midpoint and line slope from the same inputs
The midpoint coordinates are the averages of each pair:
For direction, divide the rise by the run: \(m = -9.6 \div 14.4 = -0.667\). The segment drops about two for every three it moves right. A slope calculator returns the same ratio, while a Pythagorean calculator confirms the hypotenuse if you enter 14.4 and 9.6 as legs. A vertical segment has no defined steepness.
Euclidean distance versus Manhattan and great-circle distance
The Euclidean distance formula measures as the crow flies. Manhattan distance is a grid-based distance that only travels along axes: \(|\Delta x| + |\Delta y|\), or 24 for A and B. Choose it when movement follows city blocks or warehouse aisles. That route is 39% longer than the direct one here. On an open flat plane, the diagonal figure is the one you want. A 3D problem adds a \(\Delta z^2\) term under the root.Results across other gap sizes.
Latitude and longitude need a different method
Do not feed latitude and longitude into flat maths. Earth has a curved surface, and a degree of longitude shrinks toward the poles; at 60° it spans about half its equatorial width. Use the haversine equation, a great-circle formula that takes decimal degrees and returns the great-circle distance over the globe.
Using straight-line distance to plan a barn camera cable
I need to know whether one copper Ethernet cable can run from my farmhouse router to a new barn camera. For my first mounting spot, the answer is no: the gap is 94.74 m, already past the 90 m permanent-link limit used in ANSI/TIA-568 cabling (100 m once patch cords are included).
I tape the yard from one fence corner, so both coordinate points are in the same unit, metres: router (3.6, 4.2) and camera (78.9, 61.7). I enter them in that order into the Distance Calculator (2D) and click Calculate. Then I repeat the distance formula by hand. The gaps are 75.3 and 57.5, the sum of squares is 5,670.09 + 3,306.25 = 8,976.34, and the square root is 94.74. A trench dug along axes beside the fences would be a Manhattan distance of 132.8 m.
So I rerun it with the camera on a nearer post at (69.5, 58.5), adding 3 m for the climbs at both ends:
Camera spot
Across the yard
With climbs
Margin under 90 m
Barn wall
94.74 m
97.74 m
7.74 m over
Nearer post
85.39 m
88.39 m
1.61 m spare
Here is the trap. A 3D version of the Pythagorean theorem treats a 3 m height difference as a third side and reports only 94.79 m for the wall. My cable cannot cut that diagonal through the air. It drops down one wall, crosses the yard and climbs another, so I add all 3 m. The distance between two points as the crow flies is only the shortest distance possible, never the length to order.
The number I would watch is that 1.61 m. Before buying anything, I will walk the trench route with a measuring wheel. If bends and service slack need more, I will run fibre, or keep the wall mount and put a powered switch near the midpoint, (41.25, 32.95), which splits the straight run into two legs of about 47.4 m.
Perpendicular distance to a line and signed distance
Sometimes your target is not a second location but an entire boundary. Write the line equation in general form, \(Ax + By + C = 0\). The perpendicular distance from a point (x0, y0) is:
For \(5x - 12y + 9 = 0\) and the location (7, −2), the top is 68 and the bottom is 13, giving 5.23. This tool takes two locations, not an equation, but you can confirm the figure with it: enter (7, −2) and the foot of the perpendicular, about (4.99, 2.83), to get 5.23 again. That length of the perpendicular runs along (A, B), the normal vector. Without the absolute value bars you get the signed distance, which adds what a two-location result cannot: which side you are on, useful for orientation checks.
Where geometric distance is used
You need geometric distance when two (x, y) locations decide something. Precalculus homework, exams and anyone studying analytic mathematics get both ends in the question. Game and graphics developers compare player and enemy positions with an attack range. CAD users enter floor-plan coordinates to check clearance. Two corner stakes from a surveyed lot give a straight-line distance to compare with the plan. Physics turns start and finish positions into displacement, and statistics compares two records for clustering.
Mistakes that break the distance between points
Mixed units: convert inches and feet to one system before any calculation.
Adding before squaring: square each gap separately, then sum.
Swapping axes: pair x with x and y with y.
Ignoring height: a ramp or staircase needs a 3D version.