Distance Formula Calculator
The distance between (0, 0) and (3, 4) is 5 units. This distance formula calculator measures the straight-line distance between two points on a 2D coordinate plane. Enter the x and y coordinates of the first point and the second point to get the result.
Quick answer
The distance formula finds the length of the straight line between two points.
What this tells you
- •The distance formula finds the length of the straight line between two points.
- •It uses the horizontal change (x2 - x1) and the vertical change (y2 - y1).
- •The result is the square root of the sum of those two changes squared.
- •Distances are rounded to 4 decimal places.
How to Use
- 1Enter the x and y coordinates of the first point (x1, y1).
- 2Enter the x and y coordinates of the second point (x2, y2).
- 3Click Calculate to get the distance between the two points.
How It Works
Formula
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)The distance formula comes from the Pythagorean theorem. The horizontal change (x2 - x1) and the vertical change (y2 - y1) form the two legs of a right triangle, and the distance between the points is the hypotenuse. Squaring each change, adding them, and taking the square root gives the straight-line distance.
Calculation note: values are processed in the order shown above, using the current input units.
Worked Examples
Distance from (1, 2) to (4, 6)
The change in x is 4 - 1 = 3 and the change in y is 6 - 2 = 4. Square each value to get 9 and 16, add them to get 25, then take the square root to get 5.
Distance from (0, 0) to (5, 12)
The change in x is 5 and the change in y is 12. Square each value to get 25 and 144, add them to get 169, then take the square root to get 13.
Example Distances
Common point pairs and the straight-line distance between them.
| Point 1 | Point 2 | Distance |
|---|---|---|
| (0, 0) | (3, 4) | 5 |
| (1, 2) | (4, 6) | 5 |
| (-2, -3) | (1, 1) | 5 |
| (0, 0) | (5, 12) | 13 |
Common mistakes
- Forgetting to square the differences. You must square both the change in x and the change in y before adding them, otherwise the result is wrong.
- Sign errors with negative coordinates. When a coordinate is negative, subtracting it adds a positive value, so 1 - (-2) = 3, not -1.
- Swapping x and y values. Keep the x coordinates together and the y coordinates together, and do not mix a point's x value with the other point's y value.