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.
| Dimension | Formula | Used for |
|---|---|---|
| 2D | d = √((x₂−x₁)² + (y₂−y₁)²) | Flat-plane geometry, graphs, maps, GCSE/A-Level coordinate questions |
| 3D | d = √((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.
Related formulas
- 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.

