Distance Between Two Points in 3D Calculator
Find the exact distance between two points (x1,y1,z1) and (x2,y2,z2) in 3D space using the Pythagorean theorem twice, with simplified radical and decimal steps.
The 3D distance formula
The distance between two points and in space is:
This is the Pythagorean theorem applied twice. First, project both points onto the -plane: the horizontal difference and depth difference form the legs of a right triangle whose hypotenuse is the planar distance . Second, that planar distance and the vertical difference form a second right triangle — its hypotenuse is the full 3D distance.
Step by step
To find the distance between two points in space:
- Subtract the x-coordinates: .
- Subtract the y-coordinates: .
- Subtract the z-coordinates: .
- Square all three differences and add them: .
- Take the square root of that sum — simplifying it to a smaller radical when possible, or rounding it to a decimal approximation.
Worked examples
Example 1 — irrational result, no perfect-square factor to pull out: for and , , , , so .
Example 2 — another irrational, square-free result: for and , , , , so .
Example 3 — perfect-square sum, exact whole number: for and , , , , so exactly.
Example 4 — identical points: two points with the same , , and coordinates are zero distance apart — every difference is , so .
Exact form vs. decimal approximation
Because most coordinate pairs are not a whole number of units apart, the exact 3D distance is usually an irrational number — one that never terminates or repeats as a decimal. This calculator shows both forms: the exact simplified radical (e.g. ), reduced the same way the Simplify Radicals calculator pulls perfect-square factors out of a radicand, and a rounded decimal approximation beneath it (e.g. ) for whichever a problem calls for.
Related calculators
This calculator is the direct 3D extension of Distance Between Two Points, which finds the same kind of distance on a flat plane (drop the -coordinate and the two formulas match exactly). It also shares its formula with the Rectangular Prism calculator's space diagonal — the distance between two opposite corners of a box is , the same expression with , , in place of , , . The underlying right-triangle relationship comes from the Pythagorean Theorem calculator, applied twice here instead of once. The same two points also determine a Midpoint — the point exactly halfway between them in space.
Frequently asked questions
- What is the 3D distance formula?
- The distance between two points and in space is . It is the direct 3D extension of the 2D distance formula: one extra squared term, , for the third dimension.
- Why does the 3D distance formula apply the Pythagorean theorem twice?
- First, the two points project onto the -plane, and the Pythagorean theorem gives the planar distance between those projections. Then that planar distance and the vertical difference form a second right triangle, and the Pythagorean theorem applied again gives the final 3D distance .
- Does it matter which point I call (x1,y1,z1) and which I call (x2,y2,z2)?
- No. Swapping the two points flips the sign of , , and , but each difference gets squared immediately afterward, and squaring erases the sign. The final distance comes out identical either way.
- What does it mean when the answer is a radical like √105?
- Most pairs of points in space do not sit a whole number of units apart, so the distance is an irrational number that never terminates as a decimal. This calculator reports the exact value as a simplified radical (pulling out any perfect-square factor when one exists) alongside a rounded decimal approximation.
- When is the 3D distance a whole number?
- The distance is a whole number whenever is a perfect square — for example to gives , and exactly.
- How is this related to the space diagonal of a rectangular prism?
- They are the same formula. The space diagonal of a rectangular prism with edges , , is — exactly the distance between two opposite corners of the box, where , , and .
- How is this different from the 2D distance calculator?
- The 2D distance calculator finds the distance between two points on a flat coordinate plane, and . This calculator adds a third coordinate, , for points in space — the formula is identical except for the extra term under the square root.