Distance Formula Calculator
Type the coordinates of two points, or drag them…
Type the coordinates of two points, or drag them, to get the straight-line distance between them, exactly and as a decimal.
ExampleDistance
6.7082
Exactly 3√5, the hypotenuse of a right triangle with legs 3 and 6.
Type your own points, or drag them.
Drag either point; it snaps to the grid every whole unit.
- Δx and Δy
- 3 and 6
- Midpoint
- (5/2, 4)
- Slope
- 2
How this works: 5 sources,
How this works
Method
The straight-line distance between two points is the hypotenuse of a right triangle whose legs are the horizontal and vertical gaps. So it is Pythagoras: d = √((x₂ − x₁)² + (y₂ − y₁)²). From (−3, 2) to (5, −4) the gaps are 8 and −6, and d = √(64 + 36) = √100 = 10. Full method
Sources
How it’s tested
2 worked examples for this page are checked by automated tests before every release: given the inputs, the tool must show the expected answer.
Privacy
On your device. Nothing you enter or open leaves this browser. About privacy labels
Changes
- First published: 13 shapes drawn to scale with handles, exact answers in π, litres and gallons, and slope, distance, midpoint, arc and polygon pages.
How the distance formula works
The straight-line distance between two points is the hypotenuse of a right triangle whose legs are the horizontal and vertical gaps. So it is Pythagoras: d = √((x₂ − x₁)² + (y₂ − y₁)²). From (−3, 2) to (5, −4) the gaps are 8 and −6, and d = √(64 + 36) = √100 = 10.
The signs of the gaps don’t matter, since squaring makes them positive, and neither does the order of the points. Most distances aren’t whole numbers: from (1, 1) to (4, 7) the gaps are 3 and 6, so d = √45. The calculator simplifies the root, √45 = √(9 × 5) = 3√5, and gives the decimal, about 6.7082.
The same idea works in three dimensions with a third gap, √(Δx² + Δy² + Δz²). On a map, the formula gives the distance “as the crow flies” in the map’s units; over long distances on the Earth’s curved surface, the great-circle distance is longer than this flat answer.
d = √((x₂ − x₁)² + (y₂ − y₁)²)
- US grade 8 standards ask students to apply the Pythagorean theorem to find the distance between two points in a coordinate system (8.G.B.8). Source: Common Core State Standards, Grade 8 Geometry (8.G.B.8).
- This straight-line distance is called the Euclidean distance; it is the length of the segment joining the two points. Source: Wikipedia, Euclidean distance.
Distances between pairs of points
The gaps, the sum of their squares and the distance for each pair of points, exactly and as a decimal.
| Points | Δx, Δy | Δx² + Δy² | Distance |
|---|---|---|---|
| (0, 0) to (3, 4) | 3, 4 | 25 | 5 |
| (1, 1) to (4, 7) | 3, 6 | 45 | 3√5 ≈ 6.7082 |
| (−3, 2) to (5, −4) | 8, −6 | 100 | 10 |
| (0, 0) to (1, 1) | 1, 1 | 2 | √2 ≈ 1.4142 |
| (2, −1) to (−3, 4) | −5, 5 | 50 | 5√2 ≈ 7.0711 |
| (0, 0) to (5, 12) | 5, 12 | 169 | 13 |
| (−1, −1) to (2, 3) | 3, 4 | 25 | 5 |
| (3, −2) to (7, 5) | 4, 7 | 65 | √65 ≈ 8.0623 |
| (1.5, 2) to (4, 8) | 5/2, 6 | 169/4 | 13/2 ≈ 6.5 |
| (−4, 0) to (0, 3) | 4, 3 | 25 | 5 |
Show all 12 rowsShow fewer
| (0, 0) to (8, 15) | 8, 15 | 289 | 17 |
| (2, 3) to (2, 9) | 0, 6 | 36 | 6 |
Common questions
Is the distance formula the same as Pythagoras?
Yes, applied to coordinates. The horizontal and vertical gaps are the two legs and the distance is the hypotenuse.
Can a distance be negative?
No. The gaps can be negative, but they are squared, and the square root is taken as positive. A distance of 0 means the two points are the same.
How do I find the distance from a point to a line?
That is a different formula: for the line ax + by + c = 0 and the point (x₀, y₀), it is |ax₀ + by₀ + c| ÷ √(a² + b²), the length of the perpendicular from the point to the line.