The formula for distance between two points
d = √((x₂ − x₁)² + (y₂ − y₁)²) Subtract the x-values, subtract the y-values, square both, add them, take the square root. The order of the two points makes no difference, because squaring removes the sign.
Distance and slope describe different things about the same two points: distance tells you how far apart they are, while slope tells you how steep the line between them is. If you need the rate of change between two coordinates, use the Slope Calculator.
Why it is just Pythagoras
Draw the horizontal and vertical gaps between two points and you have a right-angled triangle whose hypotenuse is the distance you want. The distance formula is the Pythagorean theorem written in coordinates — not a separate rule to remember.
That is also why the answer is so often a square root: hypotenuses rarely come out whole. When they do, as with (0, 0) to (3, 4) giving exactly 5, the gaps happen to form a Pythagorean triple.
Distance in three dimensions
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²) The same formula with one more term. It works because Pythagoras is applied twice: once across the base to get the diagonal of the floor, then again from that diagonal up to the point. The two steps collapse into the one expression above.
The same idea extends to more dimensions: add one squared coordinate difference for each axis. This is the same Euclidean distance used to compare points in areas such as statistics and machine learning.
Exact answers, not decimals
The distance from (0, 0) to (2, 3) is √13. As a decimal
that is 3.6055513…, which never terminates, so the decimal is
always a rounding. If a question asks for an exact answer, the surd is the
answer.
Surds are simplified here too: √72 becomes
6√2, and where coordinates are fractions the result is
written with a rational denominator — (3√2)/2
rather than 3/√2.
Along a path
Give several points and each leg is measured separately and added. Each leg
is calculated exactly, but a path total involving different surds such as
√2 + √3 generally cannot be reduced to one simple
surd. The calculator therefore shows the exact value of each leg and a
decimal total when the combined result cannot be expressed simply.
The straight-line distance from the first point to the last is shown alongside, which is the gap between how far you travelled and how far you actually got.
Distance and slope
Distance and slope describe different properties of the same two points. Distance tells you how far apart the points are, while slope tells you how steep the line between them is. If you need to calculate the rate of change between two coordinates, use the Slope Calculator.
Related: the equation of the line
To go from two points to the equation of the line through them, the equation of the line through two points does it in one step, with the slope and intercept worked out separately.
Frequently asked questions
What is the formula for the distance between two points?
d = √((x₂ − x₁)² + (y₂ − y₁)²). Subtract the coordinates pairwise, square the differences, add them and take the square root. In three dimensions, add a (z₂ − z₁)² term.
Does it matter which point I call the first?
No. Swapping them changes the sign of each difference, and squaring removes the sign, so the distance is identical either way.
Why is my answer a square root?
The distance is the hypotenuse of a right triangle, so the result often
contains a square root. For example, the distance from (0, 0) to (2, 3) is
√13, while the distance from (0, 0) to (3, 4) is exactly
5 because the coordinate differences form a Pythagorean triple.
How do I find the distance between two points in 3D?
Add a third squared difference for the z-coordinates: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). It is Pythagoras applied twice, once across the base and once up the vertical.
Why is a path total given as a decimal?
A path total can involve several exact surds. For example,
√2 + √3 does not simplify to a single surd, so the
calculator gives a decimal total in that case. When the legs combine into
a simpler exact form, the result can be exact as well.