The distance between two points is the length of the straight segment that joins them. On a coordinate plane you don’t need a ruler: the horizontal gap and the vertical gap between the points form the legs of a right triangle, and the distance is its hypotenuse. This calculator takes two points (x₁, y₁) and (x₂, y₂) and returns the distance as a decimal and, for whole-number coordinates, as an exact simplified square root. It also reports the Manhattan distance, midpoint, slope and direction for the same pair.
How to use the distance calculator
- Under Point 1, enter x₁ and y₁. Negative numbers and decimals are fine.
- Under Point 2, enter x₂ and y₂.
- Read the Distance at the top. When the coordinates are integers and the answer isn’t a whole number, the exact value (such as √65 or 4√5) appears underneath.
- The rows below list Δx (run), Δy (rise), the squared distance d², the Midpoint, the Slope, the Direction from point 1 (measured counterclockwise from the positive x-axis) and the Manhattan distance. The diagram plots both points with the run and rise drawn as dashed legs.
There is no unit menu. The answer is in whatever unit your coordinates use.
The distance formula
Draw a horizontal line through point 1 and a vertical line through point 2. They meet at the corner (x₂, y₁), forming a right triangle with legs |Δx| and |Δy|, and the segment you want is the hypotenuse. The Pythagorean theorem, a² + b² = c², gives d² = Δx² + Δy², and a square root finishes the job. Squaring is also why the order of the points doesn’t matter: (−6)² and 6² are both 36.
Worked example: a park map
A park map is drawn on a grid in meters, with the origin at the southwest gate. The fountain is at (100, 150) and the playground at (450, 350). How far apart are they?
- Δx = 450 − 100 = 350 m east, and Δy = 350 − 150 = 200 m north.
- d² = 350² + 200² = 122,500 + 40,000 = 162,500.
- d = √162,500 = 50√65 ≈ 403.11 m in a straight line.
- On paths that run only east–west and north–south, the walk is the Manhattan distance: 350 + 200 = 550 m, about 36% farther.
- The direction from the fountain is 29.74° counterclockwise from east, a little north of east-northeast.
Exact answers and quick checks
| Δx | Δy | d² | Exact distance | Decimal |
|---|---|---|---|---|
| 3 | 4 | 25 | 5 | 5 |
| 5 | 12 | 169 | 13 | 13 |
| 8 | 15 | 289 | 17 | 17 |
| 1 | 1 | 2 | √2 | 1.414214 |
| 1 | 2 | 5 | √5 | 2.236068 |
| 2 | 3 | 13 | √13 | 3.605551 |
| 4 | 8 | 80 | 4√5 | 8.944272 |
| 6 | 6 | 72 | 6√2 | 8.485281 |
The first three rows are Pythagorean triples: whole-number legs whose hypotenuse is also a whole number. To simplify any other root, pull out the largest perfect square that divides d²: 72 = 36 × 2, so √72 = 6√2. As a sanity check, the distance is always at least the larger of |Δx| and |Δy| and never more than their sum.
Straight-line versus Manhattan distance
The last two rows of the table have the same Manhattan distance, 12, yet their straight-line distances differ: 8.94 versus 8.49. The more diagonal the trip, the more you save by cutting across. The grid route is at most √2 ≈ 1.414 times the direct one, and that worst case happens at exactly 45°. Manhattan distance is the realistic measure for city blocks, warehouse aisles and circuit-board traces. In data science the two are called the L1 and L2 (Euclidean) distances.
Map coordinates need a different formula
Latitude and longitude are angles on a sphere, not grid coordinates. A degree of latitude is about 111 km everywhere, but a degree of longitude shrinks from about 111 km at the equator to roughly 85 km at 40° latitude and to zero at the poles. Feeding raw degrees into the distance formula mixes unequal units and ignores the earth’s curvature. Use a great-circle method such as the haversine formula instead. On a site plan or a projected grid such as UTM, where coordinates are already in meters or feet, the flat formula works well.
For points with a height as well, use the 3D distance calculator. The midpoint calculator finds the point halfway between two points, and the slope calculator gives the equation of the line through them.
Frequently asked questions
What is the distance formula?
d = √((x₂ − x₁)² + (y₂ − y₁)²). Subtract the x-coordinates, subtract the y-coordinates, square both differences, add them and take the square root. For (1, 2) and (7, 10) that is √(36 + 64) = 10.
Does it matter which point I enter first?
No. Swapping the points flips the signs of Δx and Δy, but squaring removes the sign, so the distance is identical. Only the direction from point 1 changes, by exactly 180°.
Why does the answer show a value like 4√5?
When all four coordinates are whole numbers, the calculator also gives the exact distance as a simplified square root. √80 contains the perfect square 16, so √80 = 4√5 ≈ 8.944272. Most algebra and geometry courses expect the exact form.
What is the difference between straight-line and Manhattan distance?
Straight-line (Euclidean) distance is the length of the direct segment between the points. Manhattan distance is |Δx| + |Δy|, the length of a route that only travels along grid lines, like a taxi on a street grid. It is never shorter than the straight-line distance.
Can I use latitude and longitude as coordinates?
Not for real-world distances. Degrees of longitude shrink toward the poles and the earth is curved, so this flat formula gives wrong answers except over very short spans. Use a great-circle method such as the haversine formula for map coordinates.
What units is the distance in?
The same units as your coordinates. If the grid is marked in meters, the answer is in meters. If you count map squares instead, multiply the result by the size of one square.