Distance Calculator
Enter two points to get the straight-line distance between them, as an exact value and as a decimal.
Inputs
Distance (d)
7.0711
Exact value: 5√2. Shown to 4 decimal places.
- Horizontal difference (Δx)
- 5
- Vertical difference (Δy)
- −5
- Δx squared
- 25
- Δy squared
- 25
- Sum of squares
- 50
- Exact form
- √50 = 5√2
Drag to pan. Ctrl + scroll, pinch or + / - to zoom.
Step-by-step solution
Start with the distance formula.
d = √((x₂ − x₁)² + (y₂ − y₁)²)
Substitute the coordinates.
d = √((4 − (−1))² + ((−2) − 3)²)
Subtract inside each bracket.
d = √((5)² + (−5)²)
Square each difference.
d = √(25 + 25)
Add the squares.
d = √50
Simplify the radical by taking out the largest square factor.
d = 5√2
Evaluate to 4 decimal places.
d ≈ 7.0711
The distance formula
d = √((x₂ − x₁)² + (y₂ − y₁)²) the Pythagorean theorem on the coordinate plane
- d
- the distance between the points
- x₂ − x₁
- the horizontal difference, Δx
- y₂ − y₁
- the vertical difference, Δy
Draw a horizontal line from one point and a vertical line from the other until they meet. That makes a right triangle whose legs have lengths |Δx| and |Δy|, and the segment between the points is its hypotenuse. The Pythagorean theorem, a² + b² = c², then gives d² = Δx² + Δy².
The dashed lines on the graph show exactly that triangle. You can open it in the triangle calculator to find its area and angles.
Worked examples
Distance from (1, 2) to (7, 10).
Δx = 7 − 1 = 6, Δy = 10 − 2 = 8
d = √(6² + 8²) = √(36 + 64) = √100 = 10
Distance from (−1, 3) to (4, −2).
Δx = 4 − (−1) = 5, Δy = −2 − 3 = −5
d = √(5² + (−5)²) = √50 = 5√2 ≈ 7.0711
The first example is the familiar 3-4-5 triangle doubled to 6-8-10, so the distance is a whole number. In the second, Δy is negative, but squaring removes the sign, which is why the direction of travel never matters.
Exact values and decimals
To simplify a radical, pull out the largest perfect square that divides the number under the root. For 50 that factor is 25, so √50 = √(25 × 2) = 5√2. For 72 it is 36, so √72 = 6√2. A sum such as 13 has no square factor, so √13 stays as it is.
The calculator shows the exact form whenever the sum of squares is a whole number, then the decimal at the precision you picked. Squares and sums are carried at full precision, and only the last step is rounded, so choosing fewer decimal places never changes the underlying value.
Units
The answer is in the same unit as your coordinates. If the axes are in centimetres the distance is in centimetres. Nothing is converted. Both coordinates must use the same unit, or the formula compares unlike quantities.
Distances you will see again and again
Some pairs of points give a whole-number distance. These come from Pythagorean triples such as 3-4-5, 5-12-13 and 8-15-17. Most other pairs give an irrational distance, which is why the exact radical form is worth keeping alongside the decimal.
| Points | Distance | Exact form |
|---|---|---|
| (0, 0) to (3, 4) | 5.0000 | √25 = 5 |
| (0, 0) to (5, 12) | 13.0000 | √169 = 13 |
| (0, 0) to (8, 15) | 17.0000 | √289 = 17 |
| (0, 0) to (1, 1) | 1.4142 | √2 |
| (0, 0) to (2, 2) | 2.8284 | √8 = 2√2 |
| (1, 2) to (4, 6) | 5.0000 | √25 = 5 |
| (−3, −4) to (2, 8) | 13.0000 | √169 = 13 |
Frequently asked questions
Does the order of the points matter?
No. Each difference is squared, and a squared number is never negative, so (x₂ − x₁)² and (x₁ − x₂)² are equal. The distance from A to B is the distance from B to A.
Why is the distance never negative?
It is the square root of a sum of squares, and both parts are zero or positive. The result is zero only when the two points are the same.
What does the exact radical form mean?
When the sum of squares is not a perfect square, the true distance is an irrational number that no decimal can write exactly. A simplified radical such as 5√2 is the exact value, and the decimal is an approximation of it. Use the radical when you need an exact answer and the decimal when you need to measure or compare.
How many decimal places should I choose?
Match the precision of your inputs, or whatever your assignment asks for. The default of 4 places suits most coursework. The setting only changes how the final answer is displayed; the calculation itself is not rounded along the way.
Can I use this for distance on a map or the globe?
Not for latitude and longitude. This calculator measures straight-line distance on a flat coordinate plane. Locations on the Earth sit on a curved surface, and they need a great-circle formula such as the haversine formula.
Is this the same as Manhattan distance?
No. Manhattan, or taxicab, distance adds the horizontal and vertical differences, |Δx| + |Δy|, as if you had to travel along a grid. The distance formula gives the direct line between the points, which is never longer.