CalcDuck

3D Distance Calculator

3D Distance Calculator

Distance between A and B
13
Midpoint
(2.5, 4, 9)
Δx (x2 − x1)
3
Δy (y2 − y1)
4
Δz (z2 − z1)
12
Vector magnitude of A (|OA|, distance from origin)
3.7417
Vector magnitude of B (|OB|, distance from origin)
16.6433

The distance between two points in 3D space is the Euclidean distance formula: d = √((x2−x1)² + (y2−y1)² + (z2−z1)²). For example, the distance from (1, 2, 3) to (4, 6, 15) is √(3² + 4² + 12²) = √169 = 13 exactly, since 3-4-12-13 is a Pythagorean quadruple.

Tip: “Copy with settings” shares a link that opens this calculator with your numbers already filled in.

How this calculator works

This calculator finds the straight-line (Euclidean) distance between two points given as (x, y, z) coordinates, along with the midpoint between them, the per-axis differences, and the vector magnitude of each point measured from the origin.

The 3D distance formula is a direct extension of the 2D distance formula, which is itself the Pythagorean theorem applied to a coordinate plane. Adding a third axis just adds one more squared term under the square root — the geometry is the same right-triangle relationship, just built in two stages: first across x and y, then up through z.

The formula

Distance: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)Midpoint: M = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2)Vector magnitude (distance from the origin): |v| = √(x² + y² + z²)

The distance formula is just the magnitude of the difference vector (x₂−x₁, y₂−y₁, z₂−z₁) — distance and vector magnitude are the same calculation applied to different vectors.

Worked example: (1, 2, 3) to (4, 6, 15)

  1. Find the per-axis differences: Δx = 4 − 1 = 3, Δy = 6 − 2 = 4, Δz = 15 − 3 = 12.
  2. Square and sum them: 3² + 4² + 12² = 9 + 16 + 144 = 169.
  3. Take the square root: √169 = 13. The two points are exactly 13 units apart.
  4. As a check, the midpoint is ((1+4)/2, (2+6)/2, (3+15)/2) = (2.5, 4, 9).

Frequently asked questions

How is this different from the 2D distance formula?

It is the same formula with one more term. The 2D distance formula is √((x₂−x₁)² + (y₂−y₁)²); the 3D version simply adds (z₂−z₁)² under the square root before taking the root.

What is vector magnitude used for here?

It is the distance of each point from the origin (0, 0, 0) — useful when your coordinates represent a direction and size (a vector) rather than just a location, such as a force, velocity, or displacement in physics or 3D graphics.

Can the coordinates be negative?

Yes. Distance only depends on the differences between coordinates, so shifting every point by the same amount (including into negative values) never changes the result.

Where is 3D distance used in practice?

It comes up in 3D graphics and game engines (collision and visibility checks), robotics and CAD (clearance between parts), physics (displacement between objects), and GPS/mapping systems that track altitude as a third coordinate.

Can I use this calculator to find the distance in 2D instead of 3D?

Yes — set the z-coordinate of both points to the same value (0 is simplest), since the (z₂ − z₁)² term then becomes 0 and drops out of the square root entirely, leaving exactly the 2D distance formula, d = √((x₂−x₁)² + (y₂−y₁)²).

Sources

Related calculators