Three-Dimensional Distance Calculator

Enter the (x, y, z) coordinates of two points to get the straight-line 3D distance, the midpoint, and the coordinate differences between them.

Quick Facts

Formula
d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
The Pythagorean theorem extended to three dimensions. Coordinates can use any consistent unit (meters, feet, pixels) — the distance comes out in that same unit.

Your Results

Calculated
3D Distance
-
Straight-line distance between Point A and Point B
Midpoint
-
(x, y, z) halfway between the two points
Coordinate differences
-
Δx, Δy, Δz (Point B − Point A)
Dominant axis
-
Axis with the largest coordinate change

Ready

Enter both points' coordinates, then press Calculate.

About the 3D Distance Formula

This calculator finds the straight-line (Euclidean) distance between two points in three-dimensional space, given their Cartesian coordinates (x, y, z). It is the direct extension of the Pythagorean theorem — the same rule that gives the hypotenuse of a right triangle — into a third dimension.

The formula

  • Distance: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
  • Midpoint: ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2) — the point exactly halfway between A and B
  • Coordinate differences: Δx = x₂−x₁, Δy = y₂−y₁, Δz = z₂−z₁ — the leg lengths of the right triangles that make up the distance

Why the order of the points does not matter

Each difference is squared before being summed, so a negative Δx contributes the same amount as a positive Δx of equal size. That means swapping Point A and Point B flips the sign of Δx, Δy, and Δz but never changes the computed distance or midpoint.

Where this formula is used

The 3D distance formula appears anywhere positions are tracked with (x, y, z) coordinates: computer graphics and game engines (checking how far apart two objects are), robotics and flight paths (straight-line distance between waypoints), physics (displacement between two positions), and CAD or engineering models. It assumes both points are measured in the same unit and the same flat (Euclidean) coordinate system — it is not the curved "great-circle" distance used between two points on the surface of a sphere like the Earth.

Frequently Asked Questions

What is the 3D distance formula?
The distance between two points (x₁, y₁, z₁) and (x₂, y₂, z₂) in three-dimensional space is d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²) — the Pythagorean theorem extended to three dimensions.
How do I find the midpoint between two 3D points?
The midpoint is the average of each coordinate: ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2). It always lies exactly halfway along the straight line connecting the two points.
Does the order of the two points matter?
No. Because each coordinate difference is squared before being added, swapping Point A and Point B flips the sign of the differences but not the distance or midpoint — the result is identical either way.
Can I use this calculator for 2D distance too?
Yes. Set both Z values (z₁ and z₂) to 0, or to any equal value, and the formula reduces to the standard 2D distance formula d = √((x₂−x₁)² + (y₂−y₁)²).