StatGardenREF. DESK
Calculators/Maths/Distance & midpoint between two points (3D)
Maths

Distance & midpoint between two points (3D) calculator

Straight-line distance and midpoint between two points in 3D space (set z = 0 for 2D).

What this calculator does

Distance & midpoint between two points (3D) works out straight-line distance and midpoint between two points in 3D space (set z = 0 for 2D). Enter your own figures above and the answer updates as you type: nothing is fixed in the code, so the result reflects exactly the numbers you supply.

The formula this calculator evaluates is printed under the tool and explained below, so you can check the working by hand or reuse it in a spreadsheet.

The formula

Formulad = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²); midpoint = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2)

The inputs explained

FieldWhat to enter
x₁A number. Starts at 0.
y₁A number. Starts at 0.
z₁A number. Starts at 0.
x₂A number. Starts at 3.
y₂A number. Starts at 4.
z₂A number. Starts at 12.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How the answer changes with x₁

Every other input is held at the calculator’s starting values while x₁ varies. Select any row to load that scenario into the calculator.

How the answer changes with x₁
x₁DistanceMidpointΔx, Δy, Δz
112.806(2.000, 2.000, 6.000)2.000, 4.000, 12.000
212.689(2.500, 2.000, 6.000)1.000, 4.000, 12.000
512.806(4.000, 2.000, 6.000)-2.000, 4.000, 12.000
1014.457(6.500, 2.000, 6.000)-7.000, 4.000, 12.000
2021.190(11.500, 2.000, 6.000)-17.000, 4.000, 12.000
5048.672(26.500, 2.000, 6.000)-47.000, 4.000, 12.000