Home › Math › Distance Between Two Points Calculator

Distance Between Two Points Calculator

Find the straight-line distance between two points in 2D or 3D, with the midpoint and the formula worked out.

Enter the x, y (and z in 3D) values in the boxes. Negative numbers and decimals are fine.

Distance (d)

-

Distance squared (d²)-
Change in x (Δx)-
Change in y (Δy)-
Change in z (Δz)-
Midpoint-

What is the distance between two points?

The distance between two points is the length of the straight line that joins them. It is used in maths and geometry, in maps and navigation, in computer graphics and games, and in physics and engineering. Enter the coordinates of both points and this calculator gives the distance, the midpoint and the change along each axis, with every step of the formula shown.

Distance formula

2D: d = √[(x₂ − x₁)² + (y₂ − y₁)²]
3D: d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]

The formula comes from the Pythagorean theorem. The change in x and the change in y are the two shorter sides of a right triangle, and the distance is its longest side (the hypotenuse).

Example

Find the distance between (1, 2) and (4, 6). The change in x is 4 − 1 = 3 and the change in y is 6 − 2 = 4. So d = √(3² + 4²) = √(9 + 16) = √25 = 5. The midpoint is ((1 + 4) ÷ 2, (2 + 6) ÷ 2) = (2.5, 4).

A 3D example: from (1, 2, 3) to (4, 6, 15), the changes are 3, 4 and 12. So d = √(9 + 16 + 144) = √169 = 13.

Midpoint formula

Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

The midpoint is the point exactly halfway between the two points. In 3D, the z values are averaged in the same way.

Good to know

  • The order of the points does not matter. The distance is the same either way.
  • Distance is never negative. It is 0 only when both points are the same.
  • The units of the distance are the same as the units of your coordinates (metres, kilometres, pixels and so on).
  • This is the straight-line distance. It is not the same as a driving or walking distance on a map.
  • To find how steep the line between the points is, use the Slope Calculator.

Related tools: Slope Calculator, Pythagorean Theorem Calculator and Triangle Area Calculator.

Need another calculator?

Browse all calculators
Scroll to Top