About the distance calculator
The distance calculator measures the straight-line distance between two points in a 2D plane, between two points in 3D space, or between two places on Earth given by latitude and longitude.
For places on Earth it gives the spherical (haversine) distance and the more accurate ellipsoidal (Vincenty, WGS-84) distance in kilometres, miles and nautical miles, along with the initial bearing.
Who should use the distance calculator
- Students using the distance formula.
- Developers and analysts working with coordinates.
- Travellers and pilots estimating straight-line distances between places.
How to use the distance calculator: what each input means
- Mode
- 2D coordinates, 3D coordinates or latitude and longitude.
- Coordinates
- Plain numbers for 2D and 3D. For Earth, use decimal degrees, with north and east positive.
How the distance calculator works: method and formula
In 2D, distance is √((x₂ − x₁)² + (y₂ − y₁)²), which is Pythagoras on the coordinate differences. In 3D, a z term is added. On Earth, the haversine formula treats the planet as a sphere of mean radius 6,371.0088 km, while Vincenty's inverse formula uses the WGS-84 ellipsoid for sub-metre accuracy.
- 2D distance
- d = √((x₂ − x₁)² + (y₂ − y₁)²)
- 3D distance
- d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
- Haversine
- a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2), d = 2R asin √a
How to read your distance calculator result
Earth distances are along the surface, not road or flight routes. The two methods typically differ by under half a percent. Initial bearing is the compass direction to set off in from the first point; the heading changes along a great-circle route.
Distance Calculator worked example
Points (1, 2) and (4, 6); (0, 0, 0) and (3, 4, 12); and London to Paris.
- 2D: √(3² + 4²) = 5.
- 3D: √(3² + 4² + 12²) = 13.
- London (51.5072, −0.1276) to Paris (48.8566, 2.3522): haversine 343.53 km, Vincenty 343.90 km, initial bearing 148.1°.
The London to Paris straight-line distance is about 343.9 km.
Practical uses of the distance calculator
- Straight-line distance between two cities.
- Distance between map or game coordinates.
- Checking homework on the distance formula.
Assumptions and limitations of this calculator
- Straight-line or great-circle distance only; it does not know roads, terrain or air routes.
- Vincenty's method can fail to converge for nearly antipodal points; the spherical value is then shown.
- Coordinates are not looked up from place names; you enter latitude and longitude.
