Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Geometry formulas

Distance in three dimensions

Find straight-line distance between two points in three-dimensional Cartesian space.

  • Geometry
  • Coordinates
  • High school · University
Geometry · Coordinates
$$d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$$

Distance in three dimensions is one of 3 coordinates formulas in the geometry section of this library, and it is used at high school · university level.

Why distance in three dimensions works

Travel from one point to the other in two stages: first move within a level plane, then rise straight up. Those two stages meet at a right angle, so the Pythagorean relation applies once inside the plane and again for the climb, and the two uses collapse into a single root of three squared differences.

What each symbol means

$(x_i,y_i,z_i)$ are endpoint coordinates.

Distance in three dimensions: when it holds

All coordinate axes must use the same length scale.

When it stops applying

All three axes must meet at right angles and share one unit of length. Latitude, longitude and altitude do not satisfy that, so applying this straight-line rule to map coordinates misreports distances on the curved Earth.

Distance in three dimensions: a worked example

Between $(0,0,0)$ and $(1,2,2)$, $d=\sqrt9=3$.

The mistake to avoid

What people do: Taking the square root of each coordinate difference and adding those roots.

Why it goes wrong: Roots do not combine that way: from the origin to (1,2,2) it gives about 3.83 when the true separation is exactly 3.

Do this instead: Square all three differences, add the three squares together, and take one root of that single total.

Distance in three dimensions: step by step

  1. Name the unknown, and the unit the answer has to come out in.
  2. Match the symbols to your values. $(x_i,y_i,z_i)$ are endpoint coordinates.
  3. Check the conditions before substituting. All coordinate axes must use the same length scale.
  4. Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most geometry slips.

Where this formula fits

Subject
Geometry formulas — 30 entries in this library
Topic
Coordinates
Level
High school · University

Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where distance in three dimensions comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.

Questions about distance in three dimensions

How does this extend beyond three coordinates?

Keep adding squared differences under the same root. The pattern continues unchanged for any number of coordinates.

How do I find the length of a vector in space?

Treat the origin as one of the two points, so the length is the root of the sum of the three squared components.

Why is the distance from the origin to (1,2,2) a whole number?

Because 1 plus 4 plus 4 lands exactly on 9. Such neat triples are much rarer in space than the familiar 3-4-5 pattern in the plane.

How far is a point from a coordinate plane?

Read one coordinate off directly. The distance to the horizontal plane is the size of the height coordinate, since the other two differences are zero.

Stuck on a problem?

Work a distance in three dimensions problem step by step

Type your own problem, or upload a photo of it. You get the method, the answer, and a check you can repeat yourself.