Distance Between Coordinates: How to Calculate Great-Circle Distance
Two GPS points look deceptively simple — four numbers, a pair of latitudes and a pair of longitudes — yet turning them into a distance trips up more people than almost any other everyday calculation. The catch is that the Earth is round, so you cannot just treat the coordinates like points on a flat sheet of graph paper and reach for the Pythagorean theorem, at least not over long distances. This guide explains how to measure the distance between two coordinates correctly using the great-circle (Haversine) method, works through a concrete example, and shows when the simpler flat-Earth approximations are good enough.
What Coordinate Distance Is and Why It Matters
The distance between two coordinates is the length of the shortest path between two points identified by latitude and longitude. On a sphere like the Earth, that shortest path is not a straight line through the planet but an arc along the surface — a segment of a "great circle," the largest circle that can be drawn on a sphere. This great-circle distance is what aircraft approximate when they fly curved-looking routes between continents.
It matters anywhere a position turns into a measurement: routing and logistics, ride-hailing fare estimates, finding the nearest store, geofencing, sports tracking, and countless data-analysis tasks that group records by how far apart they are. Get the method wrong and a flat-Earth shortcut can be off by several percent over long distances — enough to misrank "nearest" results or distort a cost estimate. Choosing the right formula for the distance involved is the whole game.
How to Calculate Great-Circle Distance
The standard, numerically stable method is the Haversine formula. Conceptually it computes the angle between the two points as seen from the Earth's centre, then multiplies that angle by the Earth's radius to get an arc length. A compact form of the calculation is:
Distance = R × arccos( sin(lat₁)·sin(lat₂) + cos(lat₁)·cos(lat₂)·cos(lon₂ − lon₁) )
Here R is the Earth's mean radius, about 6,371 km, and all latitudes and longitudes must be converted from degrees to radians before the trigonometry. The expression inside the arccosine is the cosine of the central angle between the two points; taking the arccosine recovers that angle, and multiplying by R turns it into a surface distance.
Worked example. Take two well-known cities:
- Point 1 — London: latitude 51.5074°, longitude −0.1278°
- Point 2 — Paris: latitude 48.8566°, longitude 2.3522°
1. Convert to radians: lat₁ ≈ 0.8987, lon₁ ≈ −0.00223; lat₂ ≈ 0.8527, lon₂ ≈ 0.04106
2. Compute the inner term: sin(lat₁)·sin(lat₂) + cos(lat₁)·cos(lat₂)·cos(lon₂ − lon₁) ≈ 0.99962
3. Take the arccosine: arccos(0.99962) ≈ 0.02754 radians
4. Multiply by the radius: 6,371 × 0.02754 ≈ 175 km
So London to Paris is about 175 kilometres as the crow flies. You can run any pair of points instantly with the Distance Between Coordinates calculator and choose the method that fits your needs.
Choosing a Method: Haversine, Euclidean, or Manhattan
The same calculator offers three methods, and picking the right one is a trade-off between accuracy and simplicity.
Haversine (great-circle). This is the accurate spherical method and the right default for any distance beyond a few kilometres, or any pair of points far apart in latitude. It correctly accounts for the curvature of the Earth and is typically within about half a percent of the true distance, the small error coming from the Earth being a slightly flattened sphere rather than a perfect one.
Euclidean (flat-Earth approximation). This treats a small patch of the globe as a flat plane, scaling longitude by the cosine of the latitude to account for meridians converging toward the poles. Over short distances — a city, a neighbourhood — it is fast and close enough. Over long distances it drifts because it ignores curvature entirely.
Manhattan (city-block). This sums the north–south and east–west distances separately rather than taking the diagonal, mimicking travel along a grid of streets. It is useful as a rough proxy for road distance in gridded cities, but it always overstates the straight-line distance and should never be mistaken for it.
The rule of thumb: use Haversine unless you have a specific reason not to, reach for Euclidean only over short spans where speed matters, and use Manhattan solely when you genuinely want grid-style distance rather than the shortest path.
Common Mistakes and How to Avoid Them
Forgetting to convert degrees to radians. Trigonometric functions in nearly every programming language and calculator expect radians. Feeding them raw degrees produces wildly wrong answers — one of the most common bugs in distance code.
Swapping latitude and longitude. Coordinates are conventionally written latitude first, but many data sources and map APIs use longitude-first ordering. Mixing the two silently corrupts every result. Always confirm the order of your source.
Mishandling the sign or the date line. Western longitudes and southern latitudes are negative. Points straddling the 180° meridian or the equator need correct signs, or the longitude difference will be computed the long way around.
Confusing straight-line with travel distance. Great-circle distance is the shortest path over the surface, not the distance a car will drive or a person will walk. Real routes follow roads and are always longer; never quote a Haversine result as a driving distance.
Conclusion
Measuring the distance between two coordinates is a small calculation with an outsized number of pitfalls, almost all of them rooted in forgetting that the Earth is round. The Haversine formula handles that curvature correctly and should be your default, with the flat-Earth Euclidean approximation reserved for short hops and Manhattan distance kept strictly for grid-style estimates. Convert your degrees to radians, keep latitude and longitude in the right order, mind the signs, and remember that the result is the shortest path over the surface — not the road you will actually travel. Get those details right and you can turn any pair of GPS points into a trustworthy distance.
Key Takeaways
• Account for curvature: Use the Haversine great-circle method by default, multiplying the central angle between the points by the Earth's radius (≈6,371 km)
• Convert and order carefully: Latitudes and longitudes must be in radians, in the correct lat/long order, with correct signs for west and south
• Match method to distance: Try Haversine, Euclidean, and Manhattan in the Distance Between Coordinates calculator — Euclidean only for short spans, Manhattan only for grid-style estimates
• It is not driving distance: Great-circle distance is the shortest surface path, always shorter than the road or walking route a real journey follows