169 TOOLS · 0 SIGN-UP
TallyBench / Coordinate Distance Calculator
// DISTANCE BETWEEN POINTS

Distance between two points, in two dimensions or three.

The distance formula is the Pythagorean theorem wearing coordinates. This applies it, and gives the midpoint too.

Distance
Midpoint
Component differences

It is Pythagoras in disguise

The distance formula, d = √((x₂−x₁)² + (y₂−y₁)²), is nothing more than the Pythagorean theorem applied to the right triangle formed by the horizontal and vertical gaps between the two points. The horizontal difference is one leg, the vertical difference the other, and the distance is the hypotenuse.

Seeing that makes the three-dimensional version obvious rather than a new thing to memorise: add a third squared term. d = √(Δx² + Δy² + Δz²). The same idea extends to any number of dimensions.

Why the squares matter

Squaring makes every term positive, so the order of the points is irrelevant — the distance from A to B equals the distance from B to A, as it must. It also means you should never take a shortcut by adding the differences directly: from (0,0) to (3,4) the differences are 3 and 4, but the distance is 5, not 7.

The midpoint is just an average

The midpoint is the average of each coordinate: ((x₁+x₂)/2, (y₁+y₂)/2). No square roots involved. It is the point equidistant from both, and it lies exactly on the segment joining them.

One caveat: this is straight-line, or Euclidean, distance. Distance on the surface of the Earth follows a curve and needs the haversine formula instead, which is why the gap between two cities on a map is not what this returns for their latitude and longitude.

Does the order of the two points matter?

No. The differences are squared, so any sign is removed and the distance from A to B is identical to the distance from B to A.

Can I use this for latitude and longitude?

Not accurately. Coordinates on a sphere need the haversine formula, which accounts for curvature. Treating latitude and longitude as flat coordinates gives errors that grow with distance and with how far you are from the equator.

How does the formula extend to more dimensions?

Add one squared difference per dimension under the same square root. Four dimensions would be √(Δx² + Δy² + Δz² + Δw²). The pattern never changes.

What is the distance from (0,0) to (3,4)?

Exactly 5. It is the best-known Pythagorean triple: 3² + 4² = 9 + 16 = 25, and √25 = 5. Any right triangle with legs in a 3:4 ratio has a hypotenuse in whole-number proportion.

For the gradient and equation of the line joining the points, use the Slope Calculator. The underlying arithmetic is the Pythagorean Theorem Calculator, and for triangles defined by three sides see the Triangle Calculator.