How the Distance Formula Works
This distance formula calculator finds the straight-line distance between two points, whether they sit on a flat 2D plane or in 3D space. The formula behind it is the Pythagorean theorem in disguise: the horizontal gap between the points forms one leg of a right triangle, the vertical gap forms the other leg, and the distance you want is the hypotenuse. Enter the coordinates, and the tool shows the substituted values, the exact radical answer, and the decimal — so you can follow the working, not just copy a number.
2D and 3D Versions
In 2D you square two differences; in 3D you square three. The pattern extends to any number of dimensions — just keep adding squared coordinate differences under the square root.
Every symbol has a concrete meaning. d is the distance itself, measured in the same units as the coordinates. (x₁, y₁) are the coordinates of the first point and (x₂, y₂) those of the second — the subscript simply labels which point a coordinate belongs to. x₂ − x₁ is the horizontal change between the points, y₂ − y₁ the vertical change, and in 3D z₂ − z₁ is the change in depth. The square root at the end converts the summed squares back into a length.
Exact vs. Decimal Answers
Many distances are irrational (like √50). Geometry classes often want the exact radical form, while applied problems want the decimal — this tool shows both.
How to Use the Calculator
- Pick the dimension: click “2D points” for flat coordinates, or “3D points” to reveal the extra z₁ and z₂ boxes.
- Enter the first point: type its coordinates into the x₁ and y₁ fields (and z₁ in 3D mode).
- Enter the second point: fill in x₂ and y₂ (and z₂) the same way — the order does not matter.
- Press Calculate Distance: the result appears as d ≈ a decimal, followed by the substitution steps and the exact form √n, so you can check each line against your own working.
Worked Example 1: From (2, 3) to (6, 6) in 2D
- Label the points: (x₁, y₁) = (2, 3) and (x₂, y₂) = (6, 6).
- Find the horizontal gap: Δx = 6 − 2 = 4. This becomes one leg of the right triangle.
- Find the vertical gap: Δy = 6 − 3 = 3. This is the other leg.
- Square each gap: 4² = 16 and 3² = 9.
- Add and take the root: d = √(16 + 9) = √25 = 5.
Verify it with Pythagoras directly: 3² + 4² = 9 + 16 = 25 = 5², so the triangle is the classic 3-4-5 right triangle and the answer 5 is exact — no rounding anywhere. Whenever the two gaps are 3 and 4, in either order and with any signs, the distance is guaranteed to be 5. That pattern is worth recognising on sight, because it shows up constantly in homework, in exams, and on job sites.
Worked Example 2: From (0, 0, 0) to (2, 3, 6) in 3D
- Find the three gaps: Δx = 2 − 0 = 2, Δy = 3 − 0 = 3, Δz = 6 − 0 = 6.
- Square each gap: 2² = 4, 3² = 9, and 6² = 36.
- Add the squares: 4 + 9 + 36 = 49.
- Take the square root: d = √49 = 7.
You can double-check a 3D answer by applying Pythagoras twice. First, the diagonal across the floor plane is √(2² + 3²) = √13. Then that diagonal and the height 6 form a second right triangle: d = √(√13² + 6²) = √(13 + 36) = √49 = 7 — the same result, as it must be. Imagine the origin as one corner of a room and (2, 3, 6) as a point 2 metres along, 3 metres across, and 6 metres up: the straight cable run between them is exactly 7 metres.
Where You Actually Use This
Any time a map gives you coordinates instead of roads: the straight-line (“as the crow flies”) distance between two GPS points, the diagonal brace needed to square a deck frame, the range between a game character and a target on a grid, or the displacement in a physics problem. In 3D it measures a drone's direct flight path between two waypoints, or the longest rod that fits diagonally inside a storage box. If the two points are cities on a real map, remember this is the flat-plane version — for long distances over the curved Earth, navigation tools switch to great-circle formulas.
Common Mistakes
- Forgetting the final square root. The sum 16 + 9 = 25 is d², not d. Reporting 25 instead of 5 is the single most common slip — always finish by taking the root.
- Squaring the sum instead of summing the squares. (Δx + Δy)² is not Δx² + Δy². Each gap must be squared separately before anything is added.
- Pairing the wrong coordinates. Subtract x from x and y from y. Mixing in a y-value where an x belongs — or forgetting the z-difference entirely in 3D mode — quietly produces a plausible-looking but wrong answer.
The same right-triangle idea powers our Pythagorean theorem calculator — and you can check the arithmetic with the four-function calculator.