Distance Formula Calculator
Enter two points to get the straight-line distance between them in 2D or 3D, worked out step by step with the distance formula. You also get the exact simplified radical, the change along each axis, the midpoint and the taxicab distance.
How to use the Distance Formula Calculator
- Pick 2D or 3D.
- Enter point 1 and point 2. Negatives and decimals are fine.
- Optionally type a unit such as m or ft to label the answer.
- Read the distance, with the exact radical form when one exists.
- Follow the steps or copy the results.
The distance formula, step by step
For points P₁(x₁, y₁) and P₂(x₂, y₂):
- Subtract to get the changes: Δx = x₂ − x₁ and Δy = y₂ − y₁.
- Square each change: Δx² and Δy².
- Add the squares.
- Take the square root: d = √(Δx² + Δy²).
Example: from (1, 2) to (7, 10), Δx = 6 and Δy = 8, so d = √(36 + 64) = √100 = 10. In 3D, add Δz² inside the square root.
Examples with whole-number distances
| Point 1 | Point 2 | Δx, Δy (, Δz) | Distance |
|---|---|---|---|
| (0, 0) | (3, 4) | 3, 4 | 5 |
| (1, 2) | (7, 10) | 6, 8 | 10 |
| (−2, 1) | (3, 13) | 5, 12 | 13 |
| (0, 0) | (8, 15) | 8, 15 | 17 |
| (0, 0, 0) | (2, 3, 6) | 2, 3, 6 | 7 |
| (1, 2, 3) | (4, 6, 15) | 3, 4, 12 | 13 |
| (0, 0) | (1, 1) | 1, 1 | √2 ≈ 1.4142 |
Frequently asked questions
What is the distance formula?
d = √((x₂ − x₁)² + (y₂ − y₁)²). It is the Pythagorean theorem applied to the right triangle whose legs are the horizontal and vertical differences between the two points.
How do you find the distance in 3D?
Add the squared change in z: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). From (1, 2, 3) to (4, 6, 15) the changes are 3, 4 and 12, so d = √(9 + 16 + 144) = √169 = 13.
What does the exact radical answer mean?
When the sum of squares is a whole number that is not a perfect square, the distance is written in simplest radical form. For example √52 = √(4 × 13) = 2√13 ≈ 7.2111.
Does the order of the points matter?
No. Each difference is squared, so swapping the points changes the signs of Δx and Δy but not the distance.
What is Manhattan distance?
Also called taxicab distance, it is the sum of the absolute differences along each axis, |Δx| + |Δy|: the distance you would travel on a grid of streets. It is always at least as large as the straight-line distance.
Can I use this for map coordinates?
Only for small areas measured on a flat grid, such as projected x/y coordinates in meters. Latitude and longitude lie on a sphere, so long distances need the haversine or great-circle formula instead.