3D Distance Calculator

Calculate the straight-line Euclidean distance between two points in 3D space (x, y, z). Also supports 2D and 1D. Shows full step-by-step working, midpoint, and direction vector.

Point Coordinates

Point A (x₁, y₁, z₁)
Point B (x₂, y₂, z₂)

Results

Euclidean Distance
Distance²
Midpoint
Direction vector (A→B)
Unit vector (A→B)
Step-by-step working

Frequently Asked Questions

d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]. This is the Pythagorean theorem extended to three dimensions. For P₁(1,2,3) and P₂(4,6,8): d = √[9+16+25] = √50 ≈ 7.071.

Euclidean distance is the straight-line ("as the crow flies") distance between two points. In nD: d = √[∑(xᵢ₂ − xᵢ₁)²]. It is the most common distance metric in physics, geometry, ML (kNN), and graphics.

Midpoint M = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2). It is the arithmetic mean of each coordinate pair — the point exactly halfway between A and B along the straight line.

Physics (atomic/molecular distances in crystallography), 3D graphics and games (collision detection, pathfinding), robotics (workspace reach), GPS navigation, machine learning (kNN distance metric), CAD engineering (component spacing). Any field working with spatial coordinates uses 3D distance.

3D Distance Formula Derivation

In 2D, the Pythagorean theorem gives the hypotenuse of a right triangle: c = √(a² + b²). In 3D, the space diagonal of a rectangular box with sides Δx, Δy, Δz is found by applying Pythagoras twice:

  • Horizontal diagonal (in xy-plane): h = √(Δx² + Δy²)
  • Full 3D diagonal: d = √(h² + Δz²) = √(Δx² + Δy² + Δz²)

This extends naturally to n dimensions: d = √(Δx₁² + Δx₂² + ... + Δxₙ²).

Related Calculators