Latitude Longitude Distance Calculator
Enter the latitude and longitude of two places and get the great-circle distance by the haversine formula, the more exact distance along the WGS84 ellipsoid by Vincenty's formula, the initial and final bearing and the midpoint. Coordinates can be decimal degrees or degrees, minutes and seconds. Runs entirely in your browser — free, no sign-up.
Decimal degrees (40.6413, −73.7781) or degrees, minutes and seconds (40°38′29″ N). A trailing N, S, E or W also works.
Point A
Point B
Results
5,540.019 km
Great-circle distance (haversine, sphere)
5,554.909 km
Ellipsoidal distance (Vincenty, WGS84)
14.89 km (0.27 %)
Difference between the two
51.4° NE
Initial bearing A → B
107.9° ESE
Final bearing on arrival at B
52.2167, -41.3027
Midpoint of the great circle
The distance in every unit
| Unit | Haversine | Vincenty |
|---|---|---|
| kilometres (km) | 5,540.019 km | 5,554.909 km |
| miles (mi) | 3,442.408 mi | 3,451.66 mi |
| nautical miles (nmi) | 2,991.371 nmi | 2,999.411 nmi |
| metres (m) | 5,540,018.95 m | 5,554,908.79 m |
The working (haversine)
- a = sin²(Δφ / 2) + cos φ₁ × cos φ₂ × sin²(Δλ / 2) = 0.17742128
- c = 2 × atan2(√a, √(1 − a)) = 0.86956699 rad
- d = R × c = 6,371.0088 km × 0.86956699 = 5,540.019 km
The haversine distance treats the Earth as a sphere of radius 6371.0088 km (the IUGG mean radius) and can be off by up to about 0.5 %. Vincenty's formula measures along the WGS84 ellipsoid and is accurate to about half a millimetre. Distances are along the surface, at sea level; they do not include height or road routes.
How to Use the Latitude Longitude Distance Calculator
- 1. Enter point A and point B. Type each latitude and longitude as decimal degrees (40.6413, −73.7781) or as degrees, minutes and seconds (40°38′29″ N). South and west are negative, or end the number with S or W.
- 2. Choose a unit — kilometres, miles, nautical miles or metres. The table below the result shows all four.
- 3. Compare the two distances. The haversine figure treats the Earth as a sphere; the Vincenty figure follows the real ellipsoid. The difference is shown so you can see whether it matters for your purpose.
- 4. Use the bearing and midpoint. The initial bearing is the compass direction to set off in; the final bearing is the direction you are travelling on arrival, which differs because great circles curve across the map.
The Haversine Formula
The shortest path between two points on a sphere is an arc of a great circle. The haversine formula finds its length without the rounding trouble that the simpler law of cosines has for short distances: with latitudes φ₁ and φ₂ and longitudes λ₁ and λ₂, a = sin²(Δφ / 2) + cos φ₁ × cos φ₂ × sin²(Δλ / 2), then c = 2 × atan2(√a, √(1 − a)) and the distance is d = R × c. The calculator uses R = 6371.0088 km, the mean Earth radius of the International Union of Geodesy and Geophysics (IUGG). Because the Earth is flattened at the poles, a sphere can mis-measure a distance by up to about 0.5 %.
Vincenty's Formula on WGS84
GPS and most maps use the WGS84 ellipsoid, with semi-major axis a = 6 378 137 m and flattening 1/f = 298.257223563. Thaddeus Vincenty's inverse formula (1975) iterates to find the length of the shortest path on that ellipsoid, the geodesic, and the azimuth at each end. It is accurate to about half a millimetre. For points that are almost exactly opposite each other on the globe the iteration can fail to settle; the calculator tells you when that happens and still gives the haversine figure.
Worked example: New York (JFK) to London (Heathrow)
Point A 40.6413, −73.7781; point B 51.4700, −0.4543.
Haversine: a = 0.17742128, c = 0.86956699 rad, d = 6371.0088 × 0.86956699 = 5,540.0 km.
Vincenty on WGS84: 5,554.9 km, which is 14.9 km (0.27 %) longer, or 3,451.7 miles.
Initial bearing 51.4° (northeast); arrival bearing 107.9° (east-southeast); great-circle midpoint 52.2167, −41.3027.
| Length of one degree | On the ellipsoid (WGS84) |
|---|---|
| Latitude, at the equator | 110.57 km |
| Latitude, at the poles | 111.69 km |
| Longitude, at the equator | 111.32 km |
| Longitude, at 60° latitude | 55.8 km (about half) |
A degree of longitude shrinks with the cosine of the latitude and reaches zero at the poles.
What the Result Does Not Include
- Terrain and height. Distances are measured along the surface at sea level. A mountain route or a flight at altitude is slightly longer.
- Roads and routes. This is the straight-line distance over the Earth's surface, not a driving or shipping distance. For a flat plane, the Distance and Midpoint Calculator applies.
- Datum. Coordinates from a different datum than WGS84 can be offset by tens or hundreds of metres, which dwarfs the Vincenty-versus-haversine gap for short lines.
Frequently Asked Questions
- How do you calculate the distance between two latitude and longitude points?
- Convert the coordinates to radians and apply the haversine formula to get the central angle between the points, then multiply by the Earth's radius (6371.0088 km). For millimetre precision use Vincenty's formula on the WGS84 ellipsoid. This calculator shows both.
- Is haversine or Vincenty more accurate?
- Vincenty, because it models the Earth's flattening; it is accurate to about half a millimetre against a sphere's error of up to roughly 0.5 %. For a few kilometres the two agree to within a few metres, so haversine is fine for casual use.
- How long is one degree of latitude or longitude?
- A degree of latitude is about 110.6 km at the equator and 111.7 km at the poles. A degree of longitude is 111.3 km at the equator and shrinks with the cosine of the latitude, so it is about 55.8 km at 60° north or south.
- What is the difference between initial and final bearing?
- A great-circle route crosses meridians at changing angles, so the direction you start in is not the direction you finish in. The initial bearing is the compass heading at point A, the final bearing is the heading on arrival at point B; on an eastbound flight in the northern hemisphere the heading swings clockwise, as it does here from 51° to 108°.
- Is this the driving distance?
- No. It is the shortest path over the Earth's surface, as the crow flies. Roads, rivers and shipping lanes are longer, often by a wide margin.
- Which coordinate formats can I type in?
- Decimal degrees with an optional minus sign or N, S, E, W letter, degrees and decimal minutes, and degrees, minutes and seconds with or without the ° ′ ″ symbols. Use the GPS Coordinate Converter to change one format into another.