The distance formula is Pythagoras with the sides named after axes. The horizontal gap and the vertical gap are the two short sides of a right-angled triangle, the distance is the hypotenuse, and d = √(Δx² + Δy²) is the whole of it. Squaring the gaps is what makes the order of the two points irrelev...
The answer is almost never a whole number. Whole coordinates give a whole distance only when the two gaps happen to form a Pythagorean triple, and among gap pairs with both sides non-zero that is 3.5% of them. Everything else is irrational: the distance from (0,0) to (4,6) is exactly 2√13, and 7.211 is a number near it that squares to 51.9985 rather than 52. This page gives the exact surd, simplified, with the decimal alongside rather than instead.
Whole numbers, decimals and fractions such as 3/4 all work.
X₁
Y₁
X₂
Y₂
(0, 0) TO (3, 4)
5
The sum of the squares is 25, which is a perfect square — so this distance is rational, which most are not.
| gap along x | 3 | squared: 9 |
| gap along y | 4 | squared: 16 |
| total | d² = 25 | |
THE ANSWER PUT BACK
5² = 25 ✓
midpoint x: 3/2 is 3/2 from each end ✓
midpoint y: 2 is 2 from each end ✓
DISTANCE SQUARED
25
a perfect square, so the root is exact
AS A DECIMAL
5
exact — the surd resolved
MIDPOINT
(3/2, 2)
the average of the coordinates, exactly
ALONG THE AXES
7
1.4× the straight line
WHAT IS HAPPENING
x: 3 − 0 = 3 · y: 4 − 0 = 4
These are the legs of a right-angled triangle, with the distance as its hypotenuse. Which point you subtract from which only changes the signs, and the next step removes those.
(3)² + (4)² = 9 + 16 = 25
Squaring is what makes the order of the points irrelevant, since a negative gap and its positive twin square to the same thing. This total is the distance squared — Pythagoras, with the sides named after axes.
d = √25 = 5
25 is a perfect square, so the distance is rational — the gaps form a Pythagorean triple. This is the uncommon case and it is worth noticing when it happens.
Why the answer is usually irrational. The distance is the square root of a sum of squares, and a square root is a whole number only when what is under it is a perfect square. Those are sparse: between 49 and 64 there are fourteen whole numbers and not one of them has a whole root. Pythagorean triples are exactly the gap pairs that land on a perfect square, and they are rare enough to have names. Everything else is a surd, and rounding it early throws away accuracy that the exact form keeps for free.
Exact fractions and surds throughout · the answer is squared back to check it reproduces d²
Enter both points. Whole numbers, decimals and fractions all work, and two or three dimensions are handled the same way — one more squared gap goes under the same root.
Read the exact answer first. If it contains a root then the distance is irrational and the decimal beneath it is a rounding, not the value.
Check the scale at the bottom. It shows where the sum of squares falls between the two nearest perfect squares, which is exactly why the root does or does not come out.
Use the squared-back line as the check. The exact answer is squared and must reproduce the sum of the squared gaps, which catches any slip in the working above it.
Take (0, 0) and (3, 4). The gaps are 3 across and 4 up. Squared, they are 9 and 16, and the total is 25. That is a perfect square, so the distance is exactly 5 — this is the 3-4-5 triangle, and it is one of the rare cases where a whole answer appears. Now take (0, 0) and (4, 6). The gaps are 4 and 6, squaring to 16 and 36, so the total is 52. Fifty-two is not a perfect square: it sits between 49 and 64, so the distance is between 7 and 8 and is irrational. The exact answer is √52, and since 52 = 4 × 13 the four comes out as a two: 2√13. The decimal is about 7.211103, and it is worth seeing what rounding costs. Take 7.211 and square it and you get 51.998521, not 52. The gap looks tiny and it compounds — carry that value into a further calculation and the error travels with it, where 2√13 stays exact for free. Now a case with fractions: (½, 0) to (1, 3/2). The gaps are ½ and 3/2. Squared they are ¼ and 9/4, totalling 10/4 = 5/2. The square root of 5/2 is √10/2, because √(5/2) = √5/√2 = √10/2 once the denominator is rationalised. Roughly 1.581. Note that the root ends up over the denominator rather than in front of it — writing it as ½√10 is the same number but reads ambiguously, so this page puts it underneath. And in three dimensions, (0, 0, 0) to (1, 2, 2). The gaps square to 1, 4 and 4, totalling 9, so the distance is exactly 3. Nothing about the method changed; there is simply one more squared gap under the same root. Finally, the contrast worth knowing. From (0, 0) to (3, 4) the straight-line distance is 5, but walking along the axes takes 3 + 4 = 7. The axis route is never shorter than the straight line and never more than √2 times longer, with the worst case at a 45° diagonal — which is exactly what the squaring in the formula is there to capture.
| Rule | What it says | Why |
|---|---|---|
| The distance formula | d = √(Δx² + Δy²) | Pythagoras with the legs named after the axes. |
| Order does not matter | squaring removes the sign | Subtracting the other way round flips both gaps and squares them the same. |
| Whole answers are rare | 3.5% of gap pairs | Only when the gaps form a Pythagorean triple. Everything else is irrational. |
| Exact beats rounded | √52 = 2√13 | 7.211 squared gives 51.9985, not 52. The error compounds on reuse. |
| Simplifying a surd | pull out square factors | √52 = √(4·13) = 2√13. Shorter, exact, and easier to compare. |
| Three dimensions | d = √(Δx² + Δy² + Δz²) | One more square under the root. Nothing else changes. |
| A gap of zero | gives a whole answer free | Purely horizontal or vertical distances are trivially whole. |
| The midpoint | average each coordinate | Exactly halfway, and exactly equidistant from both ends. |
| Along the axes | Δx + Δy, always longer | Never shorter than the straight line, never more than √2 times longer. |
| The worst case | a 45° diagonal | That is where the axis route reaches exactly √2 times the direct one. |
| Distance is never negative | the root is taken positive | The squares discard direction; only the size survives. |
| Same point | distance zero | A real answer, not an error — and the only free whole number. |
| Fractional coordinates | work unchanged | The root goes over the denominator: √2/2 rather than 0.7071. |
| From the origin | d = √(x² + y²) | The general formula with one point at zero, not a separate rule. |
d = √((x₂ − x₁)² + (y₂ − y₁)²). It is Pythagoras applied to a right-angled triangle whose short sides are the horizontal and vertical gaps between the two points, and whose hypotenuse is the distance. It is not a separate result to memorise — if you can draw the triangle you can rebuild the formula from it.
24 Times Table
Calculate instantly →
Quadratic Equation Solver
Calculate instantly →
Logarithm Calculator
Calculate instantly →
Fraction Calculator
Calculate instantly →
Fraction Simplifier
Calculate instantly →
Linear Equation Solver
Calculate instantly →
25 Times Table
Calculate instantly →
26 Times Table
Calculate instantly →
27 Times Table
Calculate instantly →
Simultaneous Equations Solver (2×2)
Calculate instantly →
28 Times Table
Calculate instantly →
Exponent Calculator
Calculate instantly →
29 Times Table
Calculate instantly →
30 Times Table
Calculate instantly →
Times Tables Mega Calculator
Calculate instantly →
Square Root of 10
Calculate instantly →
Square Root of 1
Calculate instantly →
Square Root Mega
Calculate instantly →
Square Root of 2
Calculate instantly →
23 Times Table
Calculate instantly →
Last updated: August 6, 2026 · Exact surds throughout, never a rounded decimal alone · A whole-number distance needs a Pythagorean triple, which is 3.5% of gap pairs.