SnapDistance Team
Published March 15, 2026·Updated March 21, 2026·6 min read

What Is the Haversine Formula? A Simple Explanation

The Haversine formula works with Earth's spherical coordinate system to find the shortest path between any two points on the surface.

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)

  1. Takes the latitude and longitude of two locations as input
  2. Converts coordinates from degrees to radians
  3. Calculates the differences between the coordinates
  4. Applies trigonometric functions (sine and cosine) for Earth's curvature
  5. 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.

The Haversine formula dates back to 1795 — originally designed for hand calculation by navigators, it remains the standard for distance computation today.

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:

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.