3D Distance Calculator

Find the straight-line distance between two points in 3D space.

zyx(x₁, y₁, z₁)(x₂, y₂, z₂)

3D distance formula

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

Enter two points in 3-D space

Point 1 (P₁)

Point 2 (P₂)

What is 3-D distance?

Three-dimensional distance is the straight-line length between two points (x₁, y₁, z₁) and (x₂, y₂, z₂) in 3-D space. It generalises the familiar 2-D distance formula by adding a Δz² term under the square root: d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]. The same Pythagorean theorem is applied twice — once in the horizontal xy-plane to get the diagonal shadow of the segment, and then once more between that shadow and the vertical z-gap to get the full hypotenuse.

Three-dimensional distance shows up everywhere physical space is modelled: a CAD designer measuring two corners of an assembly, a chemist computing the bond length between two atoms, a robotics engineer fitting a robotic arm into a workspace, a flight planner working out the slant range between an aircraft and a runway, a graphics programmer testing whether the camera intersects a model. In each case the answer is the same √(Δx² + Δy² + Δz²) — only the units and the interpretation change.

How the 3-D distance calculator works

Enter both points

Type the (x, y, z) coordinates of the start and end points. The same coordinate system and the same unit must be used for all six values.

Read the distance and breakdown

The headline is the straight-line distance. The breakdown panel shows Δx, Δy, Δz, the magnitude of the direction vector, the unit vector, and the midpoint.

Inspect direction cosines

The direction cosines cos α, cos β, cos γ tell you the angle the segment makes with each coordinate axis. They always satisfy cos²α + cos²β + cos²γ = 1.

Rotate the isometric view

The SVG isometric scene lets you drag to rotate around the vertical axis so you can see the segment from different sides without losing track of which axis is which.

Formulas inside this tool

3-D distance

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

Pythagoras applied twice — once in the xy-plane, then with the z-gap.

Direction vector

v = ⟨Δx, Δy, Δz⟩

The displacement from P₁ to P₂ written as a single vector.

Magnitude

‖v‖ = d

The length of the direction vector equals the 3-D distance.

Unit vector

v̂ = v / ‖v‖

A length-1 vector pointing the same way as v — direction without magnitude.

Direction cosines

cos α = Δx/d, cos β = Δy/d, cos γ = Δz/d

Angles α, β, γ are the angles the segment makes with the x, y, z axes.

Midpoint

M = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2)

Average each coordinate independently.

Where 3-D distance shows up

Computer graphics

Lighting equations, frustum culling, ray-sphere intersection, collision detection — every step that touches a 3-D scene uses Euclidean distance under the hood.

Chemistry and biology

Bond lengths in a molecule, distances between atoms in protein-folding models, drug-binding pocket geometry — all measured with the 3-D distance formula on Ångström-scale coordinates.

Surveying and construction

Total stations record 3-D coordinates of every reference point on a site; 3-D distance tells the foreman how far apart two corner stakes really are once height is included.

Aviation and aerospace

Slant range between aircraft and runway, distance to a satellite, plane-to-plane separation in 3-D traffic-management systems.

Why a calculator instead of mental arithmetic?

Squaring three numbers, summing, and taking a square root is mechanical, but easy to slip on under pressure — especially when one of the coordinates is negative, when the values are large, or when the difference Δz is much smaller than Δx and Δy. This calculator keeps every intermediate value visible so you can spot a typo immediately and shows the equivalent unit vector and direction cosines so you can also reason about direction, not just distance.

Frequently Asked Questions

The straight-line distance between two points in three-dimensional space. It generalises the 2-D distance formula by adding a Δz² term under the square root: d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]. Pythagoras applied twice — first in the xy-plane, then between that diagonal and the vertical z-gap.

Project the segment onto the xy-plane. Its shadow has length √(Δx² + Δy²). Then look at the right triangle whose horizontal leg is that shadow and whose vertical leg is Δz. Pythagoras gives the hypotenuse — the full 3-D distance — as √((Δx² + Δy²) + Δz²) = √(Δx² + Δy² + Δz²).

The cosines of the angles a vector makes with the positive x, y, and z axes. They are the components of the unit vector v̂ = v/‖v‖ and always satisfy cos²α + cos²β + cos²γ = 1.

It is the direction vector divided by its own length: v̂ = ⟨Δx, Δy, Δz⟩ / d. The result is a vector of length 1 pointing the same way as the original — useful for separating 'how far' from 'which way'.

Average each coordinate separately: M = ((x₁ + x₂)/2, (y₁ + y₂)/2, (z₁ + z₂)/2). The midpoint lies on the line segment and is exactly equidistant from both endpoints.

Yes. The displacement vector from P₁ to P₂ is ⟨Δx, Δy, Δz⟩, and its magnitude ‖v‖ = √(Δx² + Δy² + Δz²) is exactly the 3-D distance between the two points.

Computer graphics (camera-to-object distance, lighting, ray tracing), CAD and BIM modelling, robotics (joint kinematics), molecular chemistry (atomic distances), surveying, aviation (terrain clearance), and physics simulations.

Only after converting them to the same unit. Squaring values mixes units in a way that no longer represents a real geometric distance, so always normalise — convert all three coordinates to metres, feet, or whatever single unit the problem uses.

The direction is along the positive z-axis — straight up. The direction cosines are cos α = 0, cos β = 0, cos γ = 1, meaning angles of 90°, 90°, and 0° with the x, y, and z axes respectively.

3-D distance is the length of the straight line between two points. Path distance is the length of whatever route is actually taken between them — which could be a curve, a corridor, or a road network — and is always ≥ the straight-line distance.