Distance Calculator · Practical guide

Distance Between Two Points in 3D

Add one more squared term for the z-axis — the 2D formula extends naturally into three dimensions.

At a glance

The 3D Distance Formula

For points (x₁, y₁, z₁) and (x₂, y₂, z₂), the distance is d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). It is the 2D formula with one extra squared difference for the vertical (z) axis — the Pythagorean theorem applied twice in a row.

Interactive tool

Distance Calculator

Enter your own values, then compare the result with the examples below.

Results

Distance-
Midpoint-
Formula Used-
Step-by-Step-

Worked Example

Find the distance from (1, 2, 3) to (4, 6, 8). The differences are 3, 4, and 5. Squared: 9, 16, and 25. Sum: 50. So d = √50 ≈ 7.0711. The midpoint — the center of the segment — is ((1+4)/2, (2+6)/2, (3+8)/2) = (2.5, 4, 5.5). The calculator above reports both values plus the step-by-step working when you use the 3D tab.

More 3D Practice

Point 1Point 2DistanceMidpoint
(0, 0, 0)(2, 3, 6)7(1, 1.5, 3)
(1, 1, 1)(5, 5, 5)≈ 6.9282(3, 3, 3)
(−1, 2, 0)(3, −2, 4)≈ 6.9282(1, 0, 2)

Where 3D Distance Shows Up

  • Computer graphics and games: every collision check and camera calculation measures 3D distances between objects.
  • Physics and engineering: displacement between two positions in space, antenna spacing, and cable lengths.
  • Data science: Euclidean distance between points with three features — the same formula extends to any number of dimensions.

Frequently Asked Questions

Why does the 3D formula have three squared terms?

Each axis contributes one leg of the right-triangle structure. Squaring and summing all three differences is equivalent to applying the Pythagorean theorem first in a plane, then again with the z-axis.

What is the midpoint formula in 3D?

Average each coordinate pair: ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2). It is the point exactly halfway along the segment connecting the two endpoints.

Can I use negative coordinates in 3D?

Yes. Points in any octant work the same way because the differences are squared. From (−1, 2, 0) to (3, −2, 4) the distance is √48 ≈ 6.9282.

Is 3D distance ever zero or negative?

Distance is zero only when all three coordinates match — the same point — and it can never be negative, since it is the square root of a sum of squares.