Tools · Calculators · Math Last update: Nov 9, 2026

Distance Formula Calculator

Find the distance between two points in 2D or 3D with the distance formula – step by step, with the exact value, the midpoint and the slope.

Dimensions
—

More coordinate tools

The middle point between two points.

The distance formula

The distance between A(x₁, y₁) and B(x₂, y₂) is

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

It is the Pythagorean theorem in disguise: the horizontal and vertical differences are the two legs of a right triangle, and the distance is the hypotenuse.

Worked example

A(1, 2) and B(7, 10): Δx = 7 − 1 = 6 and Δy = 10 − 2 = 8. d = √(6² + 8²) = √(36 + 64) = √100 = 10. When the result is not a whole number, the calculator also shows it as a simplified root: from (0, 0) to (2, 6) the distance is √40 = 2√10 ≈ 6.324555.

In three dimensions

Add the third difference under the root: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). From (1, 2, 3) to (4, 6, 15): √(9 + 16 + 144) = √169 = 13.

Slope and midpoint

For two points in a plane the calculator also gives the slope, Δy / Δx = 8 / 6 ≈ 1.333333, and the midpoint ((1 + 7) / 2, (2 + 10) / 2) = (4, 6). A vertical line, where Δx = 0, has an undefined slope.

Frequently asked questions

What is the distance between (1, 2) and (7, 10)?

10. The differences are 6 and 8, and √(36 + 64) = 10.

Does the order of the points matter?

No. The differences are squared, so swapping A and B gives the same distance.

Is this the distance between two places on a map?

No – it is the straight-line distance in a flat coordinate system. Distances on the Earth need the curvature of the globe.