How far is it from one GPS point to another as the crow flies? This calculator takes two pairs of coordinates and returns the shortest distance over the Earth's surface, the initial bearing to follow, the bearing on arrival and the midpoint of the route.
It gives two answers on purpose. The headline value uses Vincenty's method on the WGS 84 ellipsoid, the same Earth model as GPS, accurate to well under a millimetre. The second uses the haversine formula on a sphere of mean radius 6,371.0088 km, the simple formula found in most code snippets. The difference between the two (up to about 0.5%) shows how much the Earth's flattening matters for your route.
Coordinates can be typed in decimal degrees (48.8566, 2.3522) or in degrees, minutes and seconds with hemisphere letters (48°51′24″N 2°21′08″E). Distances can be shown in kilometres, miles, nautical miles or metres. To change the notation of a coordinate itself, use the coordinate converter.
How to use this calculator
- Enter point A as "latitude, longitude": north and east are positive, south and west negative (or use N/S/E/W letters).
- Enter point B the same way.
- Read the distance on the WGS 84 ellipsoid; switch the unit to miles or nautical miles if needed.
- Compare with the haversine distance and the difference between them.
- Use the initial bearing (degrees clockwise from true north) to set off, and the midpoint for a halfway meeting place.
The formula
Haversine (sphere of radius km, the IUGG mean radius), with latitudes and longitudes in radians:
Initial bearing on the sphere:
Vincenty's inverse method works on the ellipsoid ( m, ). It maps each latitude to a reduced latitude , then iterates on the longitude difference on an auxiliary sphere until it changes by less than rad, and finally computes the geodesic length from series coefficients and . The bearings shown come from the same solution.
Worked example
Paris (48.8566, 2.3522) to London (51.5074, −0.1278)
- Haversine: km
- WGS 84 ellipsoid: 343.92 km
- Initial bearing 330.0°, roughly north-west; midpoint 50.1885, 1.1466, out in the English Channel, about 30 km off the coast of Picardy.
Paris to New York (40.7128, −74.0060): haversine 5,837.2 km, ellipsoid 5,852.9 km. Over this long route the sphere underestimates by 15.7 km, and you leave Paris heading 291.8°, well north of due west, because the shortest path curves towards the pole.
Sphere or ellipsoid: which distance should I use?
The Earth is about 21 km wider at the equator than from pole to pole. A sphere ignores this, so the haversine result can be off by up to roughly 0.5%, depending on direction and latitude: routes running north-south in mid-latitudes tend to show the largest gaps.
| Use | Recommended |
|---|---|
| Quick estimates, games, sorting by proximity | Haversine is fine |
| Surveying, aviation and marine planning, legal boundaries | Ellipsoid (WGS 84) |
| Matching GPS devices and mapping software | Ellipsoid (WGS 84) |
Both are "as the crow flies". Road distance is longer, often by 20 to 40%.
Bearings, midpoint and antipodes
On a great circle the compass heading changes along the way: the initial bearing is only valid at the start, which is why the final bearing is shown too. A route that keeps a constant heading (a rhumb line) is longer except along a meridian or the equator.
Vincenty's iteration can fail for nearly antipodal points, on almost opposite sides of the globe. Karney's 2013 algorithm solves those cases; here the calculator falls back to the haversine value and says so, which is accurate to within about 0.5% at that scale.
Frequently asked questions
How do I calculate the distance between two latitude and longitude points?
Convert the coordinates to radians and apply the haversine formula, d = 2R·asin(√h), with R = 6,371 km. For GPS-grade accuracy use an ellipsoidal method such as Vincenty’s on WGS 84, which this calculator does automatically.
Which Earth radius does the haversine formula use?
This calculator uses the IUGG mean radius, 6,371.0088 km. Some sources use 6,371 km or 6,378 km (the equatorial radius); the result scales in proportion to the radius chosen.
How accurate is the haversine formula?
Because the Earth is flattened, a spherical formula can be wrong by up to about 0.5% (roughly 5 m per kilometre). The difference row shows the exact gap for your two points.
Can I enter coordinates in degrees, minutes and seconds?
Yes. Type for example 48°51′24″N 2°21′08″E, or 48 51 24 N, 2 21 8 E. Decimal degrees with a minus sign for south and west work too.
What is the initial bearing?
It is the direction to set off in, measured clockwise from true north (0° = north, 90° = east). It is not a constant heading: following the shortest path, the bearing slowly changes until you reach the final bearing.
Sources
- T. Vincenty (1975), Direct and inverse solutions of geodesics on the ellipsoid, Survey Review (NOAA NGS copy)
- C. F. F. Karney (2013), Algorithms for geodesics, Journal of Geodesy 87
- H. Moritz, Geodetic Reference System 1980, Journal of Geodesy (IUGG mean radius R1 = 6,371,008.8 m)
- NGA TR8350.2, Department of Defense World Geodetic System 1984
- GeographicLib documentation — Geodesics on an ellipsoid of revolution (Karney)
Last updated: