Distance Between Coordinates: How to Calculate Great-Circle Distance
The shortest distance between two points on the Earth's surface is an arc of a great circle, found by computing the central angle between the points from their latitudes and longitudes and multiplying by the Earth's radius (6,371 km). London to Paris works out to about 344 km. This guide shows the two standard formulas, a worked example, and when the simpler flat-Earth methods are acceptable.
What Great-Circle Distance Is
A great circle is the largest circle that can be drawn on a sphere, and the shortest surface path between two points follows one. It is what aircraft approximate on long routes, and it is the right measure anywhere a position becomes a distance: logistics, ride-fare estimates, nearest-store searches, geofencing and any analysis that groups records by how far apart they are. Treating coordinates as points on flat graph paper works over a few kilometers and drifts over hundreds; over continents it is badly wrong.
How to Calculate It
Two formulas give the central angle θ between points (lat₁, lon₁) and (lat₂, lon₂), with all angles in radians.
Spherical law of cosines:
θ = arccos( sin lat₁ · sin lat₂ + cos lat₁ · cos lat₂ · cos(lon₂ − lon₁) )
Haversine formula:
a = sin²((lat₂ − lat₁)/2) + cos lat₁ · cos lat₂ · sin²((lon₂ − lon₁)/2), θ = 2 · atan2(√a, √(1 − a))
Either way, distance = R × θ with R = 6,371 km, the mean Earth radius recommended by the International Union of Geodesy and Geophysics. The two formulas are mathematically equivalent; the haversine form is numerically better behaved for very short distances, where the cosine of a tiny angle rounds to 1.
Worked example. London (51.5074°, −0.1278°) to Paris (48.8566°, 2.3522°):
1. Convert to radians: lat₁ = 0.89897, lon₁ = −0.00223; lat₂ = 0.85271, lon₂ = 0.04105
2. Inner term: sin(0.89897) · sin(0.85271) + cos(0.89897) · cos(0.85271) · cos(0.04328) = 0.998546
3. Central angle: arccos(0.998546) = 0.053925 radians
4. Distance: 6,371 × 0.053925 ≈ 343.6 km (the haversine form gives the same 343.6 km)
The Distance Between Coordinates Calculator returns this figure in kilometers with its "Haversine (Great Circle)" option; it also offers the two flat-Earth approximations described below, so you can see how far each drifts from the great-circle value. The Great Circle Distance Calculator uses the haversine form directly and can return kilometers, miles or nautical miles.
Haversine, Euclidean or Manhattan
Great circle. The default for anything beyond a few kilometers. Because the Earth is slightly flattened rather than a perfect sphere, spherical results are typically within about 0.3–0.5% of the true ellipsoidal distance.
Euclidean (flat-Earth). Treats the local patch as a plane: 111.32 km per degree of latitude, with the longitude difference scaled by the cosine of the mean latitude because meridians converge toward the poles. For London–Paris it gives 344.0 km, within 0.1% of the great-circle value, and it is fine for short spans and quick sorting. Over long distances and near the poles it drifts.
Manhattan (city-block). Adds the north–south and east–west distances instead of taking the diagonal, mimicking travel along a street grid. It always exceeds the straight-line distance and is useful only as a rough proxy for grid-city road distance.
Common Mistakes
Feeding degrees to trigonometric functions. Every programming language and most calculators expect radians. Multiply degrees by π/180 first.
Swapping latitude and longitude. Coordinates are conventionally latitude first, but many APIs and file formats are longitude first. Check the order of your source.
Sign errors. West longitudes and south latitudes are negative. Points straddling the 180° meridian or the equator need correct signs or the longitude difference comes out the long way around.
Quoting great-circle distance as travel distance. Roads and walking routes are always longer than the straight surface path.
Over-trusting the sphere. For surveying-grade work, use an ellipsoidal method (Vincenty or Karney) rather than any spherical formula.
Related guide: Map Scale: How to Convert Map Distance to Real-World Distance.