How to use this calculator
- Enter or choose space.
- Enter or choose point 1: x₁.
- Enter or choose point 1: y₁.
- Enter or choose point 2: x₂.
- Enter or choose point 2: y₂.
- The distance updates as you type. Use Copy result or Share to keep it.
Method
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²); midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2, …); slope = Δy ÷ Δx
- (x₁, y₁, z₁)
- the first point
- (x₂, y₂, z₂)
- the second point (z is 0 in 2D)
Worked example
- Δx = 4 − 1 = 3 and Δy = 6 − 2 = 4.
- d = √(3² + 4²) = √25 = 5.
- Midpoint = ((1 + 4)/2, (2 + 6)/2) = (2.5, 4).
The points (1, 2) and (4, 6) are 5 units apart, with midpoint (2.5, 4).
What the result means
The answer is in the same units as the coordinates. For points given as latitude and longitude, this flat-plane formula is wrong over any real distance; use a great-circle (haversine) method instead.
Assumptions and limits
- Coordinates are Cartesian and use the same unit on every axis.
- Not for latitude and longitude: the Earth is curved.
Questions
Is the distance formula the same as Pythagoras?
Yes. Δx and Δy are the legs of a right triangle and the distance is its hypotenuse; in 3D the theorem is applied twice.
Why is the slope undefined?
When both points have the same x, the line is vertical and Δy ÷ Δx would divide by zero.