3D distance calculator — straight-line gap between two points in space

Type the x, y and z coordinates of two points and the calculator gives the straight-line distance between them and the point halfway, with the working shown.

Live demo · real result from this tool
Distance7
Midpoint
(2, 3.5, 6)

Working

d = √((Δx)² + (Δy)² + (Δz)²)  = √(2² + 3² + 6²)  = √(4 + 9 + 36) = √49 = 7

Processed on your device — nothing is uploaded.

How to use the 3D distance calculator

  1. Enter the first point as x₁, y₁ and z₁.
  2. Enter the second point as x₂, y₂ and z₂.
  3. Read the Distance and the Midpoint.
  4. Check the Working, which lists Δx, Δy and Δz, their squares and the square root.

What it does and when to use it

Use this when your points have height or depth as well as position on a plane: the length of a cable between two anchor points at different heights, the diagonal of a room or a shipping box, the gap between two atoms in a molecule model, or the distance between objects in a 3D game or CAD file. Students meet it in 3D coordinate geometry and when finding the length of a vector.

For flat points, use the 2D distance calculator. The 3D vector calculator works with directions and angles in space. The Pythagorean calculator explains the right-triangle rule this formula is built on.

How it works

The tool uses the 3D distance formula:

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

It is the Pythagorean theorem applied twice. First the floor diagonal √(Δx² + Δy²) is found, then that diagonal and the height difference Δz form a second right triangle. The midpoint averages each coordinate: ((x₁ + x₂)/2, (y₁ + y₂)/2, (z₁ + z₂)/2).

Worked examples

Step by step. From (2, −1, 4) to (8, 1, 7).

  1. Differences: Δx = 8 − 2 = 6, Δy = 1 − (−1) = 2, Δz = 7 − 4 = 3.
  2. Squares: 36, 4 and 9.
  3. Add them: 36 + 4 + 9 = 49.
  4. Square root: √49 = 7.

The working ends √(36 + 4 + 9) = √49 = 7, and the tool gives Midpoint: (5, 0, 5.5).

A box diagonal. A box 3 by 4 by 12 units, from corner (0, 0, 0) to (3, 4, 12), gives Distance: 13. A rod up to 13 units long fits inside from corner to corner, even though the longest edge is only 12. The floor diagonal alone is 5 (from 3 and 4), and 5 with 12 makes 13.

Limits and tips

  • No units are attached. Keep all six coordinates in the same unit.
  • Answers that are not whole show up to 10 significant figures. In maths classes you may need to leave them as a square root, which the working line shows (for example √29).
  • Everything is worked out in your browser.

Frequently asked questions

How is this different from the 2D distance formula?
It adds a third squared difference for z. With both z values equal, Δz is 0 and the answer matches the 2D distance calculator.
Can I find the longest rod that fits in a box?
Yes. Put one corner at (0, 0, 0) and the opposite corner at (length, width, height). The distance is the space diagonal of the box.
Do negative coordinates work?
Yes. The differences are squared, so their signs do not matter for the distance.
Can it measure distances between GPS positions?
Not directly. Latitude, longitude and altitude are not x, y, z on a flat grid. Convert them to a 3D Cartesian system first, or use a great-circle method for surface distance.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close