Enter the x, y (and z in 3D) values in the boxes. Negative numbers and decimals are fine.
Distance (d)
-
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
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
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.
Related calculators
Slope Calculator
Find the slope, line equation and intercepts from two points.
Use calculator →Pythagorean Theorem Calculator
Find the hypotenuse or a missing side of a right triangle.
Use calculator →Triangle Area Calculator
Find the area of a triangle from its sides or base and height.
Use calculator →