GPS Distance Calculator
Measure the shortest distance between two coordinates on the WGS84 ellipsoid with Vincenty’s method, compared with the spherical haversine formula.
Distance on a curved surface
The shortest path between two points on the Earth is not a straight line on a flat map but an arc of a great circle on the globe, or more exactly a geodesic on the ellipsoid. For short distances the difference is negligible; across an ocean it is the reason a flight from London to New York heads north-west over Ireland and Newfoundland instead of due west. This calculator gives two answers. The haversine formula treats the Earth as a sphere with the mean radius of 6,371 km. Vincenty’s method solves the problem on the WGS84 ellipsoid, which is 21 km flatter at the poles than at the equator, and is accurate to well under a millimetre.
A worked example
From London Heathrow (51.4700, −0.4543) to New York JFK (40.6413, −73.7781), the ellipsoidal distance is 5,554.9 km, or 3,451.7 statute miles and 2,999.4 nautical miles. The spherical haversine distance is 5,540.0 km, 14.9 km shorter, an error of 0.27%. That is typical: the sphere can be wrong by up to about 0.5%, depending on direction and latitude. Along the equator, one degree of longitude is 111.32 km on the ellipsoid but 111.20 km on the mean sphere, because the equatorial radius of 6,378 km is larger than the mean. North-south distances near the poles go the other way.
What the number is and is not
The result is the length of the shortest path over the surface of the ellipsoid at sea level. It is not a driving or walking distance, which follows roads and trails and is commonly 20% to 40% longer than the straight line in a city and far more in mountains. It also ignores height: two points 1 km apart horizontally with a 300 m height difference are about 1.04 km apart in three dimensions. Airlines plan routes along great circles but deviate for winds, airspace and tracks, so actual flown distances are usually a few percent longer than the geodesic. A common misconception is that the shortest route looks shortest on a Mercator map; on that projection great circles appear as curves bending towards the pole.
When the formulas struggle
Vincenty’s iteration fails to converge for points that are almost exactly opposite each other on the globe, such as the equator at 0° and 179.7° E with a small latitude offset. In that rare case the calculator falls back to the spherical result and says so. The haversine formula itself is numerically stable at all distances, which is why it replaced the older spherical law of cosines for short distances, where that formula loses precision.
How to use it
- Enter the latitude and longitude of point A in decimal degrees or DMS.
- Enter point B the same way, remembering the minus sign or S and W.
- Read the ellipsoidal distance in kilometres, miles and nautical miles.
- Compare it with the spherical figure to see how much the Earth’s flattening matters for your route.
Questions from the map table
How do you calculate the distance between two GPS coordinates?
For most uses, the haversine formula on a sphere of radius 6,371 km is enough: it is accurate to about 0.5%. For survey-grade results, use Vincenty’s or Karney’s method on the WGS84 ellipsoid, which this calculator does. London Heathrow to JFK is 5,554.9 km on the ellipsoid and 5,540.0 km on the sphere.
Is the haversine formula accurate?
It is exact for a perfect sphere, but the Earth is an ellipsoid, so it can be off by up to about 0.5%, or 5 m per kilometre. That is fine for travel planning and fitness tracking but not for surveying, property boundaries or engineering, which need an ellipsoidal method.
Why is my GPS distance shorter than the road distance?
The calculator gives the straight-line distance over the Earth’s surface. Roads and trails wind around buildings, rivers and hills, so travel distances are commonly 20% to 40% longer in towns and much more in mountains. Height differences also add a little to the true length.
What is a nautical mile?
Exactly 1,852 m, originally one minute of arc of latitude. Because of that link to the globe, it is used in aviation and at sea: a degree of latitude is about 60 nautical miles. Speeds in knots are nautical miles per hour.
Disclaimer: Map results are calculations on the WGS84 datum from the coordinates and measurements you enter. They are not a navigation device, a land survey or a safety assessment. Carry a map and compass outdoors, check the datum of your map, apply the current magnetic declination, and rely on deeds and licensed surveyors for property boundaries and areas.