How this calculator works
- Step 1DifferencesΔx, ΔyHow far apart the points are along each axis.
- Step 2Square and addΔx² + Δy²The legs of a right triangle, squared.
- Step 3Square rootd = √(…)The hypotenuse is the straight-line distance.
The distance formula is Pythagoras’ theorem applied to the gaps between coordinates. In 3D, the z-gap joins the sum.
When the squared distance is a whole number, the calculator also gives the exact answer as a simplified square root.
Worked example: (−3, −1) to (2, 3)
- Distance
d = √((x₂ − x₁)² + (y₂ − y₁)²)
- (x₁, y₁)First point (−3, −1)
- (x₂, y₂)Second point (2, 3)
- Δx2 − (−3)5
- Δy3 − (−1)4
- Squares5² + 4² = 25 + 1641
- Distance√41√41 ≈ 6.403124
This is Example 6 in OpenStax College Algebra 2e, section 2.1, which gives the same √41.
Midpoints
- (7, −2) and (9, 5)(8, 1.5)OpenStax Example 7: (8, 3/2).
- Circle centre(2, −4)Example 8: the midpoint of a diameter.
- In 3D13(1, 2, 3) to (4, 6, 15): √169.
Read the result
The distance is always zero or more and the same in either direction; only the midpoint depends on both points equally.
The change row shows how far you move along each axis to get from the first point to the second.
Assumptions and limits
- Flat axesStraight-line distance on a grid.
- Same unitEvery axis uses one unit.
- Not for the globeLatitude and longitude need a great-circle formula.
- Exact formFor whole-number d² up to 1,00,00,00,00,000.
Related coordinate tools
Distance comes from Pythagoras. Slopes and vectors use the same coordinates.
For the slope, equation and angle of the line, use the slope calculator. The vector calculator adds dot and cross products, and the root calculator simplifies the square root in an exact answer.
Common mistakes
Mistake: Adding the differences, not their squares.
Instead: Square each difference, add, then take the root.
Mistake: Losing a minus sign: 2 − (−3) as −1.
Instead: Subtracting a negative adds: 2 − (−3) = 5.
Mistake: Subtracting coordinates for the midpoint.
Instead: Average them: add and divide by 2.
Checking the method
Every golden case is re-worked with exact fractions and Newton square roots, including OpenStax Examples 6 to 8.
An independent script squares the differences exactly and finds the largest square factor by trial, then compares each answer.
Read how we test our calculators, or browse more maths calculators.