Distance Formula Calculator
This distance formula calculator finds the straight-line distance between two points and keeps the answer exact — a whole number where it comes out whole, and a fully simplified surd where it does not.
That second part matters. The distance between (−3, 2) and (3, 5) is 3√5. You will see it written as √45, or as 6.708, and neither is the finished answer.
How to Find the Distance Between Two Points
Four steps, and the middle two are where the work is.
1. Subtract the two x values, and the two y values.
2. Square both results.
3. Add the squares.
4. Take the square root of the total.
Worked through with (−3, 2) and (3, 5):
Δx = 3 − (−3) = 6 Δy = 5 − 2 = 3
6² + 3² = 36 + 9 = 45
d = √45 = 3√5
Notice the last line. √45 is correct but unfinished: 45 = 9 × 5, and the 9 comes out of the root as a 3. Leaving it inside is like handing in 6/8 instead of 3/4.
Why It Is Just Pythagoras
d = √(Δx² + Δy²)
Draw a horizontal line from one point and a vertical line from the other. They meet at a right angle, and you now have a right triangle whose two short sides are exactly the differences you just calculated. The distance you want is its hypotenuse.
So this is a² + b² = c² in different clothing, not a separate formula to memorise. That is worth knowing because a formula you can rebuild is one you cannot forget — and it is why this calculator draws the triangle, with your own numbers on it, before showing any arithmetic.
It also explains the shape of the answer. Squares of ordinary numbers are ordinary, so Δx² + Δy² is always a plain number. It is only the square root at the end that can turn awkward.
Why the Order Never Matters
Take the same two points the other way round. The differences become −6 and −3 — both signs flipped. But they are squared immediately, and (−6)² = 36 just as 6² = 36.
Squaring throws the sign away. That is the whole reason the distance from A to B equals the distance from B to A, and it is a better answer than "because distance is always positive", which describes the result rather than explaining it.
It is worth noticing what this does not say. The direction between the two points really does reverse. Size on its own is a distance; size together with direction is a displacement, and the two behave differently. If you have met vectors, this is exactly where the difference starts.
When the Answer Is a Surd, and Why It Should Stay One
Most of the time the sum of squares is not a perfect square, and the honest answer contains a root:
(1, −3) to (4, −6) → sum 18 → 3√2
(0, 0) to (2, 3) → sum 13 → √13
(4, 1) to (−2, 10) → sum 117 → 3√13
Two things get done to those answers that should not be.
Left unreduced. √18 and 3√2 are the same number, but only the second is finished. Pull out every square factor and nothing is left to simplify.
Turned into a decimal. 3√2 ≈ 4.2426, and that decimal will never be exactly right no matter how many digits you write. It is useful when you are measuring something; it is not the answer to a coordinate geometry question.
There is a third case people forget: the answer can be an exact fraction. The points (1/3, 0) and (0, 1/4) are exactly 5/12 apart — exact, and not a whole number. This page names all three kinds so you always know which you are holding.
Why Whole Answers Keep Turning Up
Do enough exercises and you will notice something odd: the answers are whole numbers far more often than they should be. That is not chance, and it is not luck.
Three whole numbers with a² + b² = c² are called a Pythagorean triple, and they are rare. The small ones are:
| 3–4–5 | 9 + 16 = 25 |
| 5–12–13 | 25 + 144 = 169 |
| 8–15–17 | 64 + 225 = 289 |
| 7–24–25 | 49 + 576 = 625 |
Every other triple is a multiple of one of these — 6–8–10 is just 3–4–5 doubled. So when two points are 3 across and 4 up, the distance is exactly 5; when they are 5 across and 12 up, it is exactly 13.
Exercises are built from these on purpose, so that the answer can be written down neatly. This calculator names the triple when it finds one, which is a quick way to learn to spot them — and spotting them lets you write the answer before you have finished the arithmetic.
Two Shortcuts Worth Knowing
If both points have the same y, the line is level, Δy is 0, and the formula collapses. The distance is simply the gap in x: (1, 3) to (6, 3) are 5 apart. No squaring, no root.
If both points have the same x, the line stands upright and the same thing happens the other way round: (4, 1) to (4, 9) are 8 apart.
These come up constantly — the sides of rectangles, the edges of grids, anything laid out square — and reaching for the full formula on one of them is wasted work. It is worth a two-second glance at the coordinates before you start.
How to Use This Distance Calculator
Four boxes, arranged as two points.
| x₁, y₁ | The first point. An empty box counts as 0 |
| x₂, y₂ | The second point |
| ← → ↑ ↓ | Move between the boxes |
| ± | Flips the sign, for a negative coordinate |
| ⁄ and . | Fraction bar and decimal point |
| ⌫ / AC | Delete one character, or clear everything |
| = | Works it out |
Fractions like 3/4 and decimals like 0.25 both work, and the answer stays exact either way. Open the working and you get the triangle drawn from your coordinates, the two differences, the squares, the root reduced as far as it goes, and the triple named when there is one.
The same two differences also give the slope of the line through the points — distance squares them and adds; slope divides one by the other. Two questions, one pair of numbers.
Distance Formula FAQ
How do you find the distance between two points?
What is the distance formula?
Does it matter which point you call the first one?
Should the answer be left as a square root or written as a decimal?
Why do textbook answers so often come out whole?
What if both points have the same y value?
Subtract, square, add, root — and then finish the job: reduce the surd, and check whether the triangle was a triple all along.