Distance Calculator

d = 5
ResultValue
Distance5
Midpoint(1.5, 2)

d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]

The Distance Formula

The distance between two points is the length of the straight segment connecting them. In two dimensions, the distance formula d = √[(x₂−x₁)² + (y₂−y₁)²] follows from the Pythagorean theorem applied to the horizontal run and vertical rise.

In three dimensions, extend the same idea: d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]. The extra term accounts for depth or height along the z-axis. This is essential in physics, 3D graphics, navigation, and molecular geometry.

The midpoint formula averages each coordinate independently. In 2D: M = ((x₁+x₂)/2, (y₁+y₂)/2). In 3D: M = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2). The midpoint is equidistant from both endpoints.

Switch between 2D and 3D modes using the tabs. The 2D mode includes a coordinate plane diagram with both points and the connecting segment drawn. Classic example: distance from (0,0) to (3,4) equals 5 because 3² + 4² = 5².

Enter coordinates and copy the distance and midpoint for geometry homework, mapping, game development, or any application requiring spatial measurement.

Examples

ExampleResult
(0,0) to (3,4)d = 5
(1,2) to (4,6)d = 5
(0,0,0) to (1,2,2)d = 3
Midpoint of (0,0) and (4,6)(2, 3)

Frequently asked questions

d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²].

Yes, for both 2D and 3D modes.

No. Distance is always the non-negative length of the segment.

Related calculators