GPS Distance (Haversine)

Great-circle distance between two coordinates, with the bearing you leave on AND the bearing you arrive on.

Run the calculator

Example

You enter

You get

Details, formula, and sources

A great circle is the shortest path but it is not a constant heading: the course turns continuously, so the initial bearing is a departure heading rather than something to steer the whole way. New York to Los Angeles leaves on 273.7 degrees and arrives on 245.9, a 27.8 degree swing, which is why a long leg is flown or sailed as a series of shorter rhumb-line legs re-cut along the way. The drift is near zero on a short leg and enormous at high latitude, and it is exactly zero along a meridian, which is itself a great circle.

Great-circle distance via the haversine formula a = sin²(Δφ/2) + cos(φ1) × cos(φ2) × sin²(Δλ/2); d = 2 × R × atan2(sqrt(a), sqrt(1−a)). R = 6371 km mean earth radius. Initial bearing from atan2(sin(Δλ) cos(φ2), cos(φ1) sin(φ2) − sin(φ1) cos(φ2) cos(Δλ)); FINAL bearing is the reverse leg's initial bearing turned 180 degrees, and the drift between them is reported as a signed shortest-angle difference.

Classical spherical trigonometry; WGS84 mean radius.

Haversine / great-circle derivations are free in navigation texts and at nist.gov and university OCW.

Estimate. AHJ and licensed professional govern.

Field names used by the API: lat1, lon1, lat2, lon2, miles

Related tools