Distance Calculator
Compute the geodesic distance and initial and final bearings between two coordinates on the WGS-84 ellipsoid. Vincenty by default, haversine fallback near antipodes.
How to use this tool
Set the From point
Type an address (live autocomplete suggestions show after two characters), paste coordinates in any of six formats, click the map for the next pin, or use the browser's location button.
Set the To point
Same options for the destination. If you type addresses, pick the suggestion that matches your intent — the dropdown shows up to five candidates from Mapbox per query.
Read the result
The result panel shows the geodesic distance in kilometres, statute miles, and nautical miles. Below the distance, initial and final bearings are reported in degrees and compass direction. The map traces the great-circle path between the two points.
Bottom line
What “distance between two coordinates” actually means
Three different distances can be defined between two surface points on Earth. They give meaningfully different numbers.
Geodesic is the shortest path along the ellipsoid surface — sub-millimetre accuracy with the right algorithm.
Great-circle is the shortest path on a perfect sphere of radius 6 371 km — ~0.5 % different from the geodesic.
Rhumb line is the path of constant compass bearing — the straight line on a Mercator chart, longer than the geodesic almost everywhere.
Default behaviour of this tool
Great circle versus rhumb line
The two are easy to confuse because both describe a path between two points on Earth — but only one is the shortest, and only one is straight to fly or sail by compass.
The great-circle path from JFK to Narita curves north through the Aleutian Islands; the rhumb line runs almost due-west and is about 11 % longer.
Commercial aviation flies the great circle (with detours for restricted airspace and weather); traditional sail navigation flew the rhumb line because it was easier to plot and to steer. Modern marine GPS routing follows the great-circle path with automated waypoints.
How the tool computes distance
Three distance algorithms dominate geodesy. Pick by the accuracy you need and the edge cases you can't accept.
| Method | Earth model | Typical error | Failure mode |
|---|---|---|---|
| Haversine | Sphere, R = 6,371 km | ≈ 0.5 % on long routes | No failure — but always ~0.5 % wrong vs ellipsoid |
| Vincenty (1975) | WGS-84 ellipsoid | ≈ 0.5 mm typical | Iteration fails at near-antipodal points (±∼ 100 km) |
| Karney (2013) | WGS-84 ellipsoid | Nanometre / machine precision | None — converges everywhere including antipodes |
Haversine assumes a perfect sphere and uses one trig identity. Cheap, no edge cases, ~0.5 % off the ellipsoid.
Vincenty's inverse iterates over the ellipsoid shape and converges to sub-millimetre. It fails on near-antipodal pairs — the canonical bug.
Karney 2013 ( Algorithms for geodesics, J. Geod.87:43–55) replaces Vincenty's Bessel-function series with a more numerically stable formulation, converging everywhere. This is what NGS uses internally; what the US National Geodetic Survey's Inverse / Forward tool implements.
The antipodal failure mode
Bearings: initial and final
The tool reports two bearings because, on a sphere or ellipsoid, the great-circle path's compass direction changes along the route.
Initial bearing is the compass direction at the start of the path. The pilot or captain steers this heading right out of the gate.
Final bearing is the compass direction at the destination. It can differ by tens of degrees from the initial bearing on long routes.
Why the bearing drifts
Distance, units, and conventions
| Unit | Definition | In metres | Where it shows up |
|---|---|---|---|
| Kilometre (km) | SI base × 1000 | 1000.000 | Engineering, science, sport, most of the world |
| Statute mile (mi) | US/UK customary mile | 1609.344 | Road distance in US/UK, casual conversation |
| Nautical mile (nmi) | 1 minute of arc at the equator (1 / 60°) | 1852.000 | Aviation, marine, military |
The nautical mile is the most coordinate-aware unit on this list — its definition ties directly to the geometry of the Earth. One minute of arc on the meridian equals one nautical mile (an approximation, but accurate to ~0.4 % on WGS-84).
Ten ways distance calculation gets used in production
Anywhere two coordinates need a number between them, the calculation below is running.
The ten cases that follow cover most of the real-world traffic. Each is paired with a worked example using real coordinates you can paste into the From and To fields.
1. Aviation flight planning (initial bearing & fuel)
Airlines compute the great-circle distance between origin and destination as the basis for fuel uplift, route filing, and en-route time estimates.
The pilot's initial bearing — the heading at the start of the route — comes from the same computation. ICAO Annex 5 specifies great-circle calculations on WGS-84 as the standard for aviation distance reporting.
Worked example: JFK (40.6413, -73.7781) → Narita (35.7720, 140.3929). Geodesic ≈ 10,839 km, initial bearing ≈ 336° (NNW), final bearing ≈ 187° (S). The route crosses the Bering Sea, not the central Pacific.
2. Maritime navigation and chart plotting
Marine captains use great-circle distance plus bearings for long open-water passages. Bowditch's American Practical Navigator (NGA Pub. 9) — the bible of marine navigation since 1802 — devotes a chapter to the spherical math behind the calculation.
Worked example: Cape Town (-33.9249, 18.4241) → Boston (42.3601, -71.0589). Geodesic ≈ 11,816 km. Sailing across the Atlantic, the rhumb line is about 250 km longer — meaningful time on a 14-knot vessel.
3. Shipping zone calculation (UPS, FedEx, USPS, DHL)
Parcel carriers compute the distance between origin and destination ZIP / postcode centroids to assign each shipment to a zone (1–8 for UPS, comparable bands for the others). The zone drives the shipping rate.
Geodesic accuracy isn't critical here — zone bands are hundreds of kilometres wide — but consistency across millions of daily shipments matters. Haversine on a sphere is usually enough.
Worked example: Memphis FedEx hub (35.0424, -89.9767) → Anchorage AK (61.2181, -149.9003). Geodesic ≈ 5,420 km, FedEx zone 8 (the highest US domestic band).
4. Cellular coverage planning & signal-strength prediction
Telecom RF engineers compute distances from cell towers to served areas as the primary input to propagation models. Free-space path loss scales as 20 × log₁₀(distance), so an accurate distance is essential to predict signal at a customer site.
Worked example:A 5G tower at the Empire State Building (40.7484, -73.9857) and a subscriber in Hoboken (40.7440, -74.0324). Distance ≈ 4,000 m — well within the cell's range. At 3.5 GHz the free-space path loss is about 115 dB.
5. GIS proximity queries — “within X km of me”
Every “coffee shops near me” query on Google Maps, Yelp, or Foursquare runs a proximity search bounded by a great- circle radius from the user's coordinate. PostGIS, Mapbox Tilesets, and BigQuery Geography all implement haversine as the underlying primitive.
Worked example: A user at Times Square (40.7580, -73.9855) querying for cafes within 800 m gets candidates whose coordinates fall inside that haversine radius — typically a few hundred records in midtown Manhattan.
6. Athletic / fitness tracking (Strava, Garmin, MapMyRun)
Fitness apps stream GPS samples — typically one per second — and sum the geodesic distance between consecutive points to compute total session distance. Errors accumulate, so the math has to be stable on millions of short segments.
Worked example:A 5 km park loop traced with 5,000 GPS samples accumulates a haversine sum that's typically within 1–2 % of the GPS-true distance — most of the error coming from GPS drift, not from the distance formula.
7. Real-estate commute distance (Zillow, Redfin, Realtor.com)
Listings display “X km from downtown” or “Y miles to nearest school” using the great-circle distance from the listing's coordinate to the named landmark.
Worked example:A condo at Pier 1, San Francisco (37.7975, -122.3937) → Salesforce Tower (37.7895, -122.3970). Distance ≈ 920 m (the “walkable downtown” bucket).
8. Earth-observation / satellite footprint
Satellite operators compute the great-circle distance from a satellite's sub-point (the lat/lon directly below the satellite) to a ground observer to determine elevation angle, slant range, and whether the bird is above the horizon at all.
Worked example: ISS sub-point (0, 0) → Greenwich Observatory (51.4779, 0). Great-circle distance ≈ 5,724 km. From its 408 km orbit, the ISS is just over the horizon (negative elevation angle).
9. Insurance — distance to fire hydrant / hospital
Property-insurance underwriters compute the distance from a structure to the nearest fire hydrant and the nearest fire station / hospital. These distances feed risk models that affect premiums.
ISO (the underwriting Insurance Services Office) publishes classification tables that explicitly use distance bands like “within 5 road miles of a recognized fire station.”
Worked example: A rural property (44.4280, -110.5885 — Yellowstone country) → nearest fire station ~ 24 km. That distance pushes the property into the highest ISO protection class and the highest base premium.
10. Geofencing & IoT proximity alerts
Smart-asset platforms (fleet trackers, asset tags, child-safety apps) compute the haversine distance from a reported GPS ping to a configured anchor point. When the distance exceeds a threshold, the platform fires an alert.
Worked example: A school bus geofence centred on a depot at (38.8895, -77.0353) with a 50 km radius. A reported ping at (39.4, -77.2) is 56.9 km away — outside the fence, alert fires.
The antipodes — and why they break naive code
Every point on Earth has exactly one antipode: the point on the opposite side of the planet about 20,004 km away.
Near antipodal points, Vincenty's iterative formula diverges — successive iterations bounce around without converging. Production code must handle this.
The classic example: Sydney (-33.8688, 151.2093) and Buenos Aires (-34.6037, -58.3816) are nearly antipodal — 19,950 km apart, just 54 km off the exact antipode.
This tool catches Vincenty's convergence failure and falls back to spherical haversine, with a visible badge so the user knows the result is approximate to about 0.5 % rather than exact. Karney 2013 (the gold standard) handles antipodes natively and is the long-term right answer; the haversine fallback here is the pragmatic short-term solution.
Choosing the right tool
| Operation | Right tool on Coordinately | Returns |
|---|---|---|
| Geodesic distance + bearings | This page | km / mi / nmi · initial + final bearing |
| Midpoint on the great circle | /tools/midpoint-calculator | Lat/lon at the great-circle midpoint |
| Initial & final bearing only | /tools/bearing-calculator | Bearings without the distance computation |
| Address to coordinates first | /tools/address-to-coordinates | Geocode each end before measuring |
| Find lat/lon from a coordinate format | /tools/coordinate-converter | Convert UTM/MGRS/Plus Code to lat/lon |
Why a result might surprise you
Common patterns that throw off intuition:
- The curved-line surprise.A “straight” line drawn on Google Maps Mercator is a rhumb line, not the geodesic. The geodesic curves visibly toward the pole on long routes.
- Final ≠ initial bearing. On a great circle, compass direction rotates as you traverse the path. Flights from JFK to Narita start heading NNW and arrive heading S.
- Nautical mile / kilometre mismatch. 1 nmi ≈ 1.852 km — frequently mis-quoted as 1.5 or 2 km. Aviation and marine charts use nmi; navigation and ETA computations use it too.
- This is surface distance, not road or air route distance. Roads add 20–40 % typical. Commercial airline routes add 1–5 % for traffic separation and weather.
- Vincenty fails at antipodes — see the section above; the haversine fallback covers it.
Privacy and data-flow notes
All distance computation happens entirely server-side or client-side from coordinates you supply.
If you type addresses into the From or To fields, the autocomplete dropdown hits Mapbox via the same /api/geocode/suggest proxy used on /tools/address-to-coordinates — server-side, no token leakage, no caching per Mapbox ToS §19.2.
Browser geolocation, when triggered by the “Use my location” button, is button-only and never automatic. Coordinates returned by the browser stay in the browser; only the derived distance / bearings are computed locally. The full data-flow policy is at /privacy-policy.
Related tools
- Midpoint calculator— Great-circle midpoint between two coordinates
- Bearing calculator— Initial and final bearing between two coordinates
- Address to coordinates— Resolve a street address to lat/lon for either endpoint
- Coordinate format converter— Convert UTM / MGRS / Plus Code → lat/lon for the inputs
- Sun position— Solar geometry at a given coordinate and time
Related articles
- Great-circle distance— The full mathematical treatment, with worked examples
- Great circle versus rhumb line— Shortest path vs constant-bearing path, side by side
- Haversine formula explained— The spherical-Earth distance formula derived
- Why flight paths look curved— The great circle on a Mercator map
- Initial and final bearing— Why compass direction drifts along a long route
Frequently asked questions
Which formula does the tool use?
By default, Vincenty's inverse formula on the WGS-84 ellipsoid — accurate to sub-millimetre numerical precision. For near-antipodal pairs where Vincenty's iterative method fails to converge, the tool falls back to spherical haversine and shows a small badge indicating the switch. The fallback's accuracy is about 0.5 percent — fine for almost any practical use, and explicit so the user knows the result is approximate.
What does "near-antipodal" mean?
Two points are antipodal if they sit on opposite sides of Earth — every point has exactly one antipode about 20,004 km away on the WGS-84 ellipsoid. Vincenty's iterative method has a known convergence problem within a few kilometres of the antipode, so the tool catches the failure and switches to the simpler spherical formula. The result is still useful; it is just not sub-millimetre.
Why are there two bearings — initial and final?
On a sphere or an ellipsoid, the great-circle (or geodesic) path between two distant points has a different compass direction at the start than at the end. Flying from New York to Tokyo, the initial bearing is roughly north-northwest (~336°) while the final bearing approaches Tokyo from the north (~187°) — a large change you do not see on a flat map. The two values bracket the bearing's evolution along the path.
Why does the path look curved on the map?
Most web maps use a flat projection (typically Web Mercator). A straight line on Mercator is a constant-bearing rhumb line, NOT the shortest path. The actual shortest path across a sphere — the great circle — is a curve on Mercator, especially at high latitudes. The polyline this tool draws is the great-circle path, sampled at 64 points so the curvature is visible.
Can I enter an address instead of coordinates?
Yes. The From and To fields accept either: paste a coordinate pair in any of the six supported formats (decimal degrees, DMS, DDM, UTM, MGRS, Plus Code) or type an address. As you type an address, an autocomplete dropdown shows up to five suggestions from Mapbox; pick one (click or Enter) and the coordinates are filled in automatically.
Can I compute driving or flying distance?
No. This tool computes the geodesic — the shortest path along the surface of the Earth, ignoring roads, airline routes, terrain, and any obstacles. Real driving distances on the road network are typically 20–40 percent longer than the geodesic; flight distances are typically slightly longer because airliners follow great-circle approximations and detour around restricted airspace and weather.
Why is the result slightly different from Google Maps?
Google Maps reports driving and walking distances via its routing engine — they include the road network and turn-by-turn distance, not the straight-line geodesic. For a fair comparison, ask Google Maps for the 'as the crow flies' or 'measure distance' tool result; that should match this tool's geodesic to within rounding.
Why does the tool report sub-mm accuracy but show only a few decimal places?
The Vincenty algorithm converges to sub-millimetre numerical precision, but the input coordinates are usually only accurate to a few metres (consumer GPS) or, at best, sub-centimetre (survey-grade RTK GPS). The displayed precision is rounded to a sensible number of decimal places for the magnitude — three decimals for sub-kilometre distances, integer kilometres for transcontinental routes. The underlying compute is full precision.
Sources
- Vincenty 1975 — T. Vincenty, "Direct and Inverse Solutions of Geodesics on the Ellipsoid with Application of Nested Equations", Survey Review XXIII, 88-93 (1975) · https://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf · Accessed .
- Karney 2013 — C. F. F. Karney, "Algorithms for geodesics", Journal of Geodesy 87:43–55 (2013) · https://link.springer.com/article/10.1007/s00190-012-0578-z · Accessed .
- NGS Geodesic Utilities — US National Geodetic Survey — Inverse / Forward / Direct geodesic utilities · https://geodesy.noaa.gov/PC_PROD/Inv_Fwd/ · Accessed .
- NIMA TR 8350.2 (WGS 84) — NIMA Technical Report 8350.2 — Department of Defense World Geodetic System 1984, 3rd ed. · https://earth-info.nga.mil/php/download.php?file=coord-wgs84 · Accessed .
- ICAO Annex 5 — ICAO Annex 5 — Units of Measurement to be Used in Air and Ground Operations (5th ed., 2010) · https://www.icao.int/Pages/default.aspx · Accessed .
- Bowditch — American Practical Navigator — NGA Publication 9 (Bowditch), the American Practical Navigator (current edition) · https://msi.nga.mil/Publications/APN · Accessed .
- Sinnott 1984 — R. W. Sinnott, "Virtues of the haversine", Sky and Telescope 68, 159 (1984) — origin of the modern haversine formula · https://www.skyandtelescope.com · Accessed .
- ISO 19111:2019 — ISO 19111:2019 — Geographic information — Referenced by coordinates · https://www.iso.org/standard/74039.html · Accessed .
- BIPM SI Brochure — BIPM SI Brochure — definition of the metre (and the nautical mile by reference to the meridian arc) · https://www.bipm.org/en/publications/si-brochure · Accessed .
- Mapbox Geocoding API v6 — Mapbox Geocoding v6 — used by the From/To address fields on this page · https://docs.mapbox.com/api/search/geocoding-v6/ · Accessed .