About the Distance Calculator
A distance calculator finds the straight-line separation between two points on a coordinate plane. It is the Pythagorean theorem applied to horizontal and vertical differences, and it underlies everything from computer graphics to clustering algorithms to navigation.
The formula
d = √((x₂ − x₁)² + (y₂ − y₁)²)The horizontal and vertical separations form the legs of a right triangle, and the distance is its hypotenuse. Squaring removes any sign, so the order of the points does not matter.
How to use this calculator
- 1Enter your Point 1: x₁. The field starts at
0, which you can overwrite. - 2Enter your Point 1: y₁. The field starts at
0, which you can overwrite. - 3Enter your Point 2: x₂. The field starts at
3, which you can overwrite. - 4Enter your Point 2: y₂. The field starts at
4, which you can overwrite. - 5Read the result straight away — it recalculates as you type, so there is no button to press. Use Share to copy a link that reopens the page with your exact numbers filled in.
Worked example
| Input | Value |
|---|---|
| Point 1: x₁ | 0 |
| Point 1: y₁ | 0 |
| Point 2: x₂ | 3 |
| Point 2: y₂ | 4 |
Result
Distance: 5.000000
Δx: 3 Δy: 4
Angle: 53.13°
Those are the values the page loads with, so you can reproduce this result yourself and then change one field at a time to see what drives the outcome.
Understanding your result
This is Euclidean distance — the length of a straight line, which is the shortest path between two points on a flat plane. It extends naturally to three dimensions by adding a z term, and to any number of dimensions beyond that, which is how similarity is measured in machine learning.
Other distance metrics exist because straight lines are not always available. Manhattan distance sums the horizontal and vertical legs instead of taking the hypotenuse, which better describes travel through a street grid. On the Earth's surface, curvature makes Euclidean distance wrong over long spans, and the haversine formula is used instead.
Things worth knowing
- Squaring the differences makes the sign irrelevant, so point order never affects the result.
- For three dimensions, add the z difference squared under the same root.
- Manhattan distance — the sum of absolute differences — is the right metric for grid-constrained movement.
- For latitude and longitude, use the haversine formula; the plane formula ignores the Earth's curvature.
- Squared distance preserves ordering, so algorithms often skip the square root for speed.
Frequently asked questions
How do I find the distance between two points?+
Subtract the coordinates, square both differences, add them, and take the square root. From (0, 0) to (3, 4) the distance is √(9 + 16) = 5.
Does the order of the points matter?+
No. The differences are squared, so a negative difference gives the same result as a positive one. Distance from A to B always equals distance from B to A.
How does this extend to three dimensions?+
Add the squared z difference under the same root: d = √(Δx² + Δy² + Δz²). The pattern continues to any number of dimensions.
Can I use this for latitude and longitude?+
Not accurately over any real distance, because the Earth is curved and a degree of longitude shrinks toward the poles. Use the haversine formula for geographic coordinates.