3D Distance Calculator

In three dimensions, the distance formula adds the gap in height (z) to the gaps in x and y.

Results update as you type.

Distance

13

Midpoint
(2.5, 4, 9)

About this calculator

Enter the x, y and z of both points.

How to use it

  1. Enter point 1.
  2. Enter point 2.
  3. Read the distance.

The formula

d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
z
the third coordinate

Worked example

(1, 2, 3) to (4, 6, 15)

  1. Gaps 3, 4 and 12.
  2. d = √(9 + 16 + 144) = 13.

What the result means

The same formula gives the space diagonal of a box.

Worked example: the longest rod that fits in a room

A room is 5 m long, 4 m wide and 3 m high. Put one floor corner at (0, 0, 0); the opposite ceiling corner is then (5, 4, 3). The calculator gives a distance of √(25 + 16 + 9) = √50 ≈ 7.071 m, the longest straight pole that fits in the room.

The midpoint (2.5, 2, 1.5) is the exact centre of the room, half-way along each direction.

Why the formula works: Pythagoras twice

First find the flat distance across the floor: √(Δx² + Δy²). Then treat that as one leg and the height gap Δz as the other leg of a vertical right triangle. The hypotenuse is √((Δx² + Δy²) + Δz²), which is the 3D formula.

This is why the 2D formula is just the 3D one with Δz = 0.

  • Pick one corner or fixed point as the origin and keep it for every point.
  • Choose the directions of x, y and z once, and measure every coordinate along them.
  • Use the same unit for all three axes; a z in centimetres with x and y in metres gives a wrong answer.

Assumptions

  • All lengths in the same unit.

Limitations

  • Results are rounded to 10 significant figures.

Frequently asked questions

What is the 3D distance formula?

√(Δx² + Δy² + Δz²).

What is the midpoint in 3D?

The average of each coordinate.

Where is it used?

In physics, graphics, engineering and data analysis.

How do I find the distance of a point from the origin in 3D?

Use √(x² + y² + z²). The point (2, 3, 6) is √(4 + 9 + 36) = 7 units from the origin.

Does it matter which point I enter first?

No. Each gap is squared, so the sign disappears and the distance is the same either way. The midpoint is also the same.

Is 3D distance the same as Euclidean distance?

Yes. Euclidean distance is the ordinary straight-line distance, and in three dimensions it is exactly √(Δx² + Δy² + Δz²).

Last reviewed on 12 October 2026. How we calculate and check. Found a mistake? Tell us.