About the Distance Formula Calculator
What is the Distance Formula Calculator?
The distance formula gives the straight-line (Euclidean) distance between two points. It comes directly from the Pythagorean theorem: the horizontal and vertical differences between the points form the legs of a right triangle, and the distance is its hypotenuse.
Enter the coordinates of two points. Leave both z-values at 0 for a flat 2D problem, or fill them in for 3D space. The calculator shows the distance, each coordinate difference (Δx, Δy, Δz) and the distance measured in the xy-plane alone.
How to use the Distance Formula Calculator
- x₁ (sample: 1)
- y₁ (sample: 2)
- z₁ (leave 0 for 2D) — leave at 0 for a 2D problem. (sample: 0)
- x₂ (sample: 4)
- y₂ (sample: 6)
- z₂ (leave 0 for 2D) — leave at 0 for a 2D problem. (sample: 0)
- Press Find Distance (results also refresh as you type). The result card shows the Distance, along with Δx, Δy, Δz and Distance in the xy-plane.
Formula used
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
- (x₁, y₁, z₁), (x₂, y₂, z₂) = the two points
In 2D the z term is zero, which gives d = √((x₂ − x₁)² + (y₂ − y₁)²).
Worked example
These are the sample values already filled in the calculator above, and the result it returns for them:
| Input | Sample value |
|---|---|
| x₁ | 1 |
| y₁ | 2 |
| z₁ (leave 0 for 2D) | 0 |
| x₂ | 4 |
| y₂ | 6 |
| z₂ (leave 0 for 2D) | 0 |
| Result | Value |
|---|---|
| Distance | 5 |
| Δx | 3 |
| Δy | 4 |
| Δz | 0 |
| Distance in the xy-plane | 5 |
Tips for using the Distance Formula Calculator
- The order of the points does not matter, because the differences are squared.
- This is the “as the crow flies” distance on a flat grid; for places on the Earth's surface use a great-circle (haversine) calculation.
- Walking along a grid of city blocks covers |Δx| + |Δy| (the Manhattan distance), which is never shorter than the straight-line distance.
