Skip to content
Calculadora.co.uk
Calculator on a desk — maths and calculation tools

Photo via Unsplash

Calculadora · Maths

Distance Between Points calculator

LIVE
Distance
5
d = √((x₂−x₁)² + (y₂−y₁)²)

Compute the Euclidean distance between two 2D or 3D points with d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²).

Editorial DeskMaths, Dates and Utilities Team
  • Combined 40+ years of editorial experience across UK consumer publishing
  • Accessibility audits performed against WCAG 2.2 AA
Reviewed by Laura Whitmore· Finance Editor

Was this helpful?

How it works

The Euclidean distance formula, and why it's just Pythagoras

This distance between points calculator finds the straight-line (Euclidean) distance between two points, in 2D or 3D coordinates. The formula looks intimidating written out — d = √((x₂−x₁)² + (y₂−y₁)²) — but it is exactly Pythagoras' theorem in disguise: the horizontal gap and vertical gap between the two points form the two legs of a right triangle, and the distance you want is the hypotenuse.

Once you see it that way, the 3D version is a natural extension — add a third squared term for the depth axis (z) under the same square root.

Three worked examples

1. Simple 2D distance

Points A(1, 2) and B(4, 6): d = √((4−1)² + (6−2)²) = √(9 + 16) = √25 = 5. This is a classic 3-4-5 right triangle in disguise.

2. Negative coordinates

Points A(−3, 2) and B(1, −1): d = √((1−(−3))² + (−1−2)²) = √(4² + (−3)²) = √(16 + 9) = √25 = 5. Negative coordinates don't change the method — squaring always makes the differences positive.

3. Distance in 3D

Points A(1, 2, 3) and B(4, 6, 3): d = √((4−1)² + (6−2)² + (3−3)²) = √(9 + 16 + 0) = √25 = 5. When the z-coordinates match, the 3D formula collapses back to the 2D one — the points lie on the same horizontal plane.

2D vs 3D: what changes

The only difference between the two versions is one extra squared term under the root.

DimensionFormulaUsed for
2Dd = √((x₂−x₁)² + (y₂−y₁)²)Flat-plane geometry, graphs, maps, GCSE/A-Level coordinate questions
3Dd = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)3D modelling, physics, computer graphics, engineering coordinates

Common mistakes

  • Subtracting in the wrong order. (x₂−x₁) and (x₁−x₂) give the same squared result, so order genuinely doesn't matter here — but forgetting to square before adding (i.e. adding the raw differences) is a real and common error.
  • Forgetting the square root at the end. √(9+16) = 5, not 25 — the sum under the root is the squared distance, not the distance itself.
  • Mixing up midpoint and distance. The midpoint is the point halfway between two coordinates; distance is how far apart they are. Different formulas, often confused because they use the same two input points.
  • Applying the 2D formula to 3D data (or vice versa) — always check how many coordinates each point actually has before picking the formula.
  • Pythagoras' theorem: a² + b² = c² — the 1D ancestor of this formula, see the Pythagoras calculator.
  • Midpoint formula: ((x₁+x₂)/2, (y₁+y₂)/2) — the point exactly between two coordinates, see the midpoint calculator.
  • Slope/gradient: (y₂−y₁)/(x₂−x₁) — uses the same coordinate differences as distance, but divides instead of squaring-and-summing.

Frequently asked questions

What is the distance formula?
d = √((x₂−x₁)² + (y₂−y₁)²) for two points in a 2D plane. It is Pythagoras' theorem applied to the horizontal and vertical gaps between the points.
What is the 3D distance formula?
d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²) — the same idea as the 2D formula with a third squared term for the depth (z) axis.
Is the distance formula the same as Pythagoras' theorem?
Yes — the distance formula is Pythagoras' theorem (a² + b² = c²) applied to coordinates, where a and b are the horizontal and vertical differences between the two points.
How do I find the distance between two points with negative coordinates?
The method is identical — subtract, square (which makes the result positive regardless of sign), add, then take the square root.
What is the difference between distance and midpoint?
Distance measures how far apart two points are; midpoint finds the point exactly halfway between them. They use the same two input coordinates but different formulas.
Does the order of the points matter?
No — (x₂−x₁)² gives the same result as (x₁−x₂)² because squaring removes the sign, so distance from A to B equals distance from B to A.
Can I use this formula for more than 3 dimensions?
Yes — the pattern extends to any number of dimensions: square the difference in each dimension, sum them all, then take the square root. It is used exactly this way in higher-dimensional data and machine learning.
What is the distance formula used for in real life?
GPS and mapping (shortest straight-line distance), computer graphics and game engines (collision and proximity checks), and physics (displacement between two positions).

References