Haversine distance (spherical)
The great-circle distance on a sphere by the haversine formula, with its error against the ellipsoidal geodesic shown.
Planning and education aid. Not for primary navigation. Full disclaimer
A published result changed on 2026-09-19: The geohash encoder, map tile for a point, tile bounds, H3 grid disk, and haversine distance are now stable, so their results no longer carry the EXPERIMENTAL_TOOL warning; the Web Mercator clamp and pentagon warnings moved to the first position. Each matches published worked examples (Wikipedia, the mercantile README, the Bing Maps Tile System, H3 C, and Rosetta Code) and agrees with a separately written library on 250 to 1,000 cases. No numbers changed. Changelog
Measures on a sphere, not on the ellipsoid the Earth actually is. Use the geodesic distance for anything you act on: it is exact on WGS 84, and this tool reports how far the sphere puts it wrong for your own two points. Karney (2013), the geodesic algorithm the geodesic tools use.
The haversine distance is 5,540.019 km, 14,890 m (0.27%) shorter than the ellipsoidal geodesic.
- Ellipsoidal distance
- Difference
- Difference (percent)
Provenance
- Computed by
- navigation.geodesic.haversine 1.0.1, core 0.1.0
- Model
- Haversine great circle on a sphere of radius R1; compared with Karney (2013) on WGS 84
- Accuracy
- Exact on the sphere. On the Earth the sphere itself is off by up to about 0.5%; the difference is reported
- Notes
- None
- Cites
- Moritz, H., International Association of Geodesy, Geodetic Reference System 1980 (mean radius R1 = (2a + b)/3); Karney, C. F. F., Journal of Geodesy, Algorithms for geodesics
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Haversine great circle on a sphere of radius R1; compared with Karney (2013) on WGS 84
Show your work
Half-chord squared
Δφ = 10.8287°, Δλ = 73.3238°, φ₁ = 40.6413°, φ₂ = 51.47°= 0.177421277Great-circle distance
2 × 6,371.009 km × asin(√0.177421277)= 5,540.019 km
The same steps an agent gets from the MCP server with explain: true.
Accuracy: Exact on the sphere. On the Earth the sphere itself is off by up to about 0.5%; the difference is reported
When to use this: Use this when you want the classic spherical distance, either because a specification calls for the haversine formula, because you are checking another system that uses it, or because you want to see how far the sphere is from the ellipsoid for your pair of points. The difference against the exact geodesic is reported beside the answer.
Limitations: A sphere is not the Earth: this can differ from the ellipsoidal distance by up to about half a percent, which is kilometers on a long leg, and the error depends on latitude and direction. Use the geodesic tool when the distance is the answer rather than the method. Course angles from a sphere carry the same approximation.
Worked example: JFK to Heathrow on the mean-radius sphere. Source: add-navigation-and-geometry scenario: about 5,540,019 m, 14,890 m (0.27%) shorter than the geodesic. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Start latitude
- 40.6413 deg
- End latitude
- 51.47 deg
- Start longitude
- -73.7781 deg
- End longitude
- -0.4543 deg
You get
- Haversine distance
- 5,540.019 km
- Ellipsoidal distance
- 5,554.909 km
- Difference
- 14,890 m
- Difference (percent)
- 0.27
Review: Not yet independently reviewed by a geodesist.
Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.
Status: version 1.0.1, core 0.1.0. See this tool in the verification report.
Changes
- 2026-09-23, fixed: Short distances lost their meaning: a 0.859 m geodesic showed as 0.001 km. Distances in the navigation tools (version 1.0.1) still show to the meter in kilometers, but a short one now keeps three significant digits, down to the millimeter, so it shows as 0.000859 km. Differences such as the rhumb line's extra distance keep fixed decimals. Values are unchanged. Changelog
- 2026-09-19, result change: The geohash encoder, map tile for a point, tile bounds, H3 grid disk, and haversine distance are now stable, so their results no longer carry the EXPERIMENTAL_TOOL warning; the Web Mercator clamp and pentagon warnings moved to the first position. Each matches published worked examples (Wikipedia, the mercantile README, the Bing Maps Tile System, H3 C, and Rosetta Code) and agrees with a separately written library on 250 to 1,000 cases. No numbers changed. Changelog
Checked against: 20 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- Geodetic Reference System 1980 (mean radius R1 = (2a + b)/3), Moritz, H., International Association of Geodesy, Journal of Geodesy 74(1). pp. 128-133.
- Algorithms for geodesics, Karney, C. F. F., Journal of Geodesy, Vol. 87, No. 1. pp. 43-55.
Terms
- IUGG: International Union of Geodesy and Geophysics
- The scientific union that adopted GRS 80 and the mean Earth radius R1. Source: Geodetic Reference System 1980
- R1: IUGG mean Earth radius
- The radius of a sphere the size of the Earth on average, (2a + b) ÷ 3 = 6,371,008.771 m for WGS 84. Spherical formulas use it when they treat the Earth as a ball. Source: Geodetic Reference System 1980
Learn the concept: Haversine vs. geodesic distance explained