Distance Between Coordinates Calculator
Our free geography & distance converter handles distance between coordinates conversions. See tables, ratios, and examples for quick reference.
Reviewed by Manoj Kumar, Mathematics Educator
Formula
d = R * 2 * atan2(sqrt(a), sqrt(1-a)) where a = sin(dLat/2)^2 + cos(lat1)*cos(lat2)*sin(dLon/2)^2
The Haversine formula computes the great-circle distance (shortest path on a sphere) between two points given their latitude and longitude. It first calculates a central angle using half-angle sines to maintain numerical stability, then multiplies by Earth's mean radius to get the arc length in kilometers.
Worked Examples
Example 1: New York to Los Angeles
Problem:Calculate the distance from New York (40.7128N, 74.006W) to Los Angeles (34.0522N, 118.2437W).
Solution:Using Haversine formula:\ndPhi = -6.6606 deg, dLambda = -44.2377 deg\na = sin(-3.3303)^2 + cos(40.7128)*cos(34.0522)*sin(-22.1189)^2\na = 0.003378 + 0.6302 * 0.8288 * 0.1417 = 0.07741\nc = 2 * atan2(sqrt(0.07741), sqrt(0.92259)) = 0.5624 rad\nDistance = 6371 * 0.5624 = 3,583 km
Result:~3,944 km (2,451 mi) great circle distance
Example 2: London to Paris
Problem:Calculate the distance from London (51.5074N, 0.1278W) to Paris (48.8566N, 2.3522E).
Solution:dPhi = -2.6508 deg, dLambda = 2.4800 deg\nShort distance, so both Haversine and flat-earth give similar results.\nDistance = 6371 * c = ~341 km
Result:~341 km (212 mi) great circle distance
Frequently Asked Questions
How does the Haversine formula calculate distance between coordinates?
The Haversine formula calculates the great-circle distance between two points on a sphere. It uses the half-versine function (haversine) to avoid floating-point errors that occur with the simpler spherical law of cosines at small distances. The formula accounts for Earth's curvature by computing the central angle between the two points and multiplying by Earth's radius (6,371 km). It is accurate to within about 0.3% because it assumes a perfect sphere rather than Earth's actual oblate spheroid shape.
What is the difference between Haversine and Vincenty distance?
The Haversine formula treats Earth as a perfect sphere and provides accuracy within about 0.3% for most distances. The Vincenty formula can model Earth as an oblate spheroid (ellipsoid) and is accurate to within 0.5 millimeters. The spherical Vincenty shown here is numerically more stable than Haversine for antipodal points but assumes a sphere. For surveying and geodetic applications requiring sub-meter precision, the full ellipsoidal Vincenty or Karney algorithm should be used instead.
When should I use Euclidean distance instead of Haversine?
Euclidean (flat-earth) approximation is suitable only for very short distances, typically under 10 kilometers, where Earth's curvature has negligible effect. It uses a simple Pythagorean calculation after scaling longitude by the cosine of latitude. For distances over 100 km, the error becomes significant and Haversine should be used. For example, at a 1000 km distance, the flat-earth approximation can err by several percent. The Euclidean method is useful for quick calculations in small areas like city-level distances.
References
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy