Explore all tools
FREE ONLINE TOOLNo visitor account required

Distance Calculator

Distance and midpoint between two points in 2D or 3D, with the coordinate differences and a plotted diagram.

—

Distance

Midpoint—
Δx—
Δy—
Δz—

Note: The diagram plots the x-y view; in 3D mode the z difference is included in the distance and midpoint but cannot be drawn on a flat plot.

Report a problem with this tool

The Distance Formula Is Pythagoras in Disguise

The distance between two points is the hypotenuse of the right triangle built on their coordinate differences: d = √((x2 − x1)2 + (y2 − y1)2). In 3D a third term joins: + (z2 − z1)2. The midpoint is simpler — just the average of each coordinate pair — and the calculator returns it too, along with the individual Δx, Δy (and Δz) differences so you can see which direction dominates the gap.

dmidpoint

Worked Example

From (1, 2) to (4, 8): Δx = 3 and Δy = 6, so d = √(9 + 36) = √45 ≈ 6.71, and the midpoint is (2.5, 5). In 3D, from (1, 2, 3) to (4, 6, 3): the differences are 3, 4 and 0, giving √(9 + 16) = 5 exactly — the classic 3-4-5 triangle standing in a horizontal plane.

Where This Gets Used

Every map pin, game engine and CNC machine runs on this formula. Distances on a screen are Euclidean distances between pixels; a warehouse robot's travel, a delivery radius check ("is this address within 5 km of the store?") and the spacing of holes on a drilled plate are all the same calculation. For distances on the Earth's surface the flat formula is only an approximation — latitude and longitude need the haversine formula once the gap exceeds a few kilometres, because the surface itself curves.

Frequently Asked Questions

What is the distance formula?

d = sqrt((x2 - x1) squared + (y2 - y1) squared) — Pythagoras applied to the coordinate differences. In 3D a third squared term for z is added.

What is the midpoint?

The point exactly halfway: average the x values and average the y values. The midpoint of (1, 2) and (4, 8) is (2.5, 5).

Can I use it for map distances?

Only for short, flat approximations. Latitude and longitude are angles on a sphere, so real map work needs the haversine formula once distances pass a few kilometres.

Why is the 3D answer sometimes the same as 2D?

When the two z values are equal the z difference is zero and adds nothing — the points sit in the same horizontal plane, like the 3-4-5 example giving exactly 5.