Haversine Distance Calculator
Find the great-circle distance between two latitude/longitude coordinates using the haversine formula.
How it works
a = sin²(Δφ/2) + cos φ₁·cos φ₂·sin²(Δλ/2) · c = 2·atan2(√a, √(1−a)) · d = R·c
The haversine formula gives the shortest distance over the Earth’s surface — the great-circle distance — between two points given as latitude and longitude. It stays numerically stable for very small distances, unlike the simpler spherical law of cosines. R is the mean Earth radius of 6,371 km.
Worked example
From New York (40.7128, −74.006) to London (51.5074, −0.1278): the haversine formula gives c ≈ 0.876 rad, so d = 6371 × 0.876 ≈ 5,570 km (3,461 mi).
Sources: Haversine formula — Wikipedia
Frequently asked questions
How accurate is the haversine distance?
It treats Earth as a perfect sphere, so it is accurate to about 0.5%. For sub-metre precision over long distances use Vincenty’s formulae on the WGS84 ellipsoid.
Is this the driving distance?
No. It is the straight-line “as the crow flies” distance over the surface. Actual travel distance by road or air is always equal to or longer than this.
What sign do I use for coordinates?
Latitude is positive north and negative south; longitude is positive east and negative west. So New York’s longitude is −74.006°.
Related calculators
Educational estimate. Uses a spherical-Earth model; results differ slightly from ellipsoidal (WGS84) calculations.