3D Distance Calculator
Enter two points in space and get the straight-line distance between them — plus the three axis legs Δx, Δy, and Δz that make up the body diagonal of a box.
The 3D distance formula
distance = √((x2 − x1)² + (y2 − y1)² + (z2 − z1)²) — the Pythagorean theorem extended to three axes. Enter six numbers, read the straight-line distance.
Order doesn't matter
Going from point A to B gives the same distance as B to A — each difference is squared, so the sign drops out.
What is the distance between two points in space?
The straight line through three dimensions
A 3D distance calculator finds the length of the straight line connecting two points in space — the shortest path between them through three dimensions. Given a first point (x1, y1, z1) and a second point (x2, y2, z2), it is found by extending the distance formula with a third term: distance = √((x2 − x1)² + (y2 − y1)² + (z2 − z1)²). This is the Pythagorean theorem applied across all three axes. The result is the "Euclidean" distance, the everyday notion of how far apart two spots are — whether they are objects in a game world, points on a 3D model, or atoms in a molecule.
Enter the six coordinates and the calculator returns the distance plus Δx, Δy, and Δz — the three axis legs — instantly.
The formula has a few short steps built from the two coordinate triples.
distance = √((x2 − x1)² + (y2 − y1)² + (z2 − z1)²)First take the three gaps Δx = x2 − x1, Δy = y2 − y1, and Δz = z2 − z1. Square each one — squaring also makes the value positive, so the order of the points never changes the answer. Add the three squares together, then take the square root. That square root is the distance, the body diagonal of the box whose edges are Δx, Δy, and Δz.
Suppose the first point is (0, 0, 0) and the second is (1, 2, 2).
Axis legs (Δx, Δy, Δz)
1 − 0 = 1, 2 − 0 = 2, and 2 − 0 = 2 — the gaps along each axis.
Square and add
1² + 2² + 2² = 1 + 4 + 4 = 9 — the sum of the squared legs.
Distance
√9 = 3 — the straight-line distance through space.
The main output is the straight-line, or "Euclidean", distance — the length of a taut string stretched directly between the two points in space, not a path that follows grid lines or surfaces. The three supporting numbers, Δx, Δy, and Δz, are the axis legs of the box whose body diagonal is that distance: each tells you how far apart the points are along one axis. Together they explain why the distance is what it is. Because each leg is squared before being added, the order of the points does not matter — swapping them flips the signs of the legs but leaves their squares, and therefore the distance, unchanged. When the two points are identical, all three legs are zero and the distance is zero. This single idea powers a wide range of real work: measuring gaps between objects in 3D modelling and CAD, collision and proximity checks in game development, the separation between atoms in molecular chemistry, and nearest-neighbour comparisons in three-dimensional data.
The formula is exact, but a couple of practical points are worth keeping in mind.
Flat space and consistent units
This is the straight-line distance through flat, three-dimensional space. It is not the driving distance along roads, nor the great-circle distance across the curved surface of the Earth. The coordinates are also unit-agnostic, so the answer is only meaningful if both points use the same unit and the same scale — mixing metres with pixels, or one axis stretched relative to another, produces a distance that means nothing.