What Is the Haversine Formula? A Simple Explanation
The Haversine formula is a mathematical equation used to calculate the distance between two points on a sphere. It powers distance calculators like SnapDistance.
Why Do We Need a Special Formula?
Earth is not flat — it is roughly spherical. A straight line on a flat map does not represent the shortest path on a curved surface. The shortest path is called a great circle, and the Haversine formula calculates its length.
How It Works (Simple Version)
- Takes the latitude and longitude of two locations as input
- Converts coordinates from degrees to radians
- Calculates the differences between the coordinates
- Applies trigonometric functions (sine and cosine) for Earth's curvature
- Multiplies by Earth's radius (6,371 km) to get the distance
How Accurate Is It?
The Haversine formula assumes Earth is a perfect sphere. The actual error is typically less than 0.3%, which is negligible for most practical purposes.
Where Is It Used?
- Distance calculators — Tools like SnapDistance
- Navigation apps — GPS devices
- Aviation — Flight planning and fuel calculations
- Logistics — Shipping distance estimation
- Location-based services — "Find nearby" features
Real-World Examples
See the Haversine formula in action on actual routes:
- London to Paris — 344 km great-circle distance
- Tokyo to Seoul — 1,160 km across the Sea of Japan
- New York to London — 5,570 km transatlantic
- Sydney to London — 16,983 km, nearly half the Earth's circumference
For routes in specific regions, explore our distances from London or distances from Tokyo hub pages.
The Formula (For the Curious)
a = sin²(Δlat/2) + cos(lat1) × cos(lat2) × sin²(Δlon/2)
distance = 2 × R × arcsin(√a)
Where R is Earth's radius (6,371 km).
Frequently Asked Questions
Is the Haversine formula the same as "as the crow flies"?
Yes. Both refer to the great-circle distance along Earth's surface.
Can it calculate driving distance?
No. It only calculates straight-line distance. Driving distance requires road network data.
Is it accurate enough for everyday use?
Absolutely. The error is typically less than 0.3%.
Do all distance calculators use the Haversine formula?
Most consumer-facing tools do. Some use the more complex Vincenty formula for higher precision.