Distance Between Coordinates
Calculate the distance between two GPS coordinates with the haversine or Vincenty (WGS84) formula, plus bearing and midpoint, in km, miles and nautical miles.
Decimal degrees (48.8566, -74.006) or degrees, minutes, seconds (48°51'24"N, 48 51 24 N, 48°51.4'N). South and west are negative, or use N/S/E/W. Pasting “lat, lon” into a latitude box fills both boxes.
Distance
–
–
The points are almost antipodal: Vincenty's formula does not converge, so the haversine result is shown.
- Kilometres
- –
- Miles
- –
- Nautical miles
- –
- Initial bearing
- –
- Final bearing
- –
Midpoint
–
Step by step
How to calculate the distance between two coordinates
- Type the Latitude and Longitude of Point A and Point B. Decimal degrees (48.8566, -74.006) and degrees, minutes, seconds (48°51‘24”N, 48 51 24 N, 48°51.4’N) both work. South latitudes and west longitudes are negative, or you can add the letters N, S, E and W instead of a sign.
- If you copied a pair such as “48.8566, 2.3522” from a map, paste it into a latitude box: this tool splits it and fills both boxes.
- Choose the Method: Haversine (sphere) or Vincenty (WGS84 ellipsoid), and the Unit used for the main result.
- The result updates as you type (Calculate does the same). You get the Distance in kilometres, miles and nautical miles, the Initial bearing, the Final bearing and the Midpoint of the route, in decimal degrees and in DMS.
- The line under the main result always compares both methods, so you can see how much the shape of the Earth matters for your two points. Swap A ⇄ B reverses the route, Copy copies the distance, bearing and midpoint, and Step by step shows the working.
The grid below the results draws the great-circle route on a simple latitude/longitude grid (a plate carrée projection). On that flat grid the shortest route usually looks curved: a flight from Paris to New York heads west-north-west, bends towards Newfoundland and arrives heading south-west.
Haversine: the distance on a sphere
The haversine formula gives the great-circle distance, the shortest path along the surface of a sphere. With latitudes φ and longitudes λ in radians:
- a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2)
- c = 2 · atan2(√a, √(1 − a))
- d = R · c
This tool uses R = 6,371.0088 km, the IUGG mean Earth radius. Because the real Earth is slightly flattened, a spherical result can be off by up to about 0.5 %, which is fine for most travel, logistics and trivia questions. Paris (48.8566, 2.3522) to New York (40.7128, -74.006) comes out at about 5,837 km with haversine.
Vincenty: the distance on the WGS84 ellipsoid
GPS coordinates are defined on the WGS84 ellipsoid (semi-major axis a = 6,378,137 m, flattening f = 1/298.257223563). Vincenty’s inverse formula solves the shortest path on that ellipsoid by iteration and is accurate to within a millimetre or so. For Paris to New York it gives about 5,853 km, some 16 km more than the sphere. The difference between the methods depends on the direction: routes along a meridian and routes along the equator are affected differently.
Vincenty’s iteration can fail to converge for nearly antipodal points (two places almost exactly opposite on the globe). In that rare case this tool shows a note and falls back to the haversine result.
Bearing and midpoint
The initial bearing (or forward azimuth) is the direction you start in, measured clockwise from true north: 0° is north, 90° east, 180° south, 270° west. On a great circle the direction changes along the way, which is why a final bearing is also shown: it is the direction of travel when you arrive at B. Both are true bearings; to steer with a magnetic compass you still need to apply the local magnetic declination.
The midpoint is the point halfway along the route, not the average of the coordinates. With Vincenty it is found by travelling half the distance along the ellipsoidal geodesic (Vincenty’s direct formula).
Frequently asked questions
Which method should I choose?
Haversine is simple and good enough for most uses (error below 0.5 %). Choose Vincenty when you need the precision of surveying or aviation software, or when you compare your result with GIS tools that work on WGS84.
Is this the driving distance?
No. It is the “as the crow flies” distance along the surface of the Earth. Roads, rivers and air corridors make real journeys longer.
How do I convert DMS to decimal degrees?
Decimal degrees = degrees + minutes/60 + seconds/3600, with a minus sign for south or west. For example 40°42‘46”N is 40 + 42/60 + 46/3600 ≈ 40.7128. This tool does the conversion for you and shows the midpoint in both formats.
What is a nautical mile?
A nautical mile is exactly 1,852 m. It was originally one minute of latitude, which is why sailors and pilots use it together with knots. A statute mile is 1,609.344 m.
Why does the route look curved on the map?
The shortest path on a globe is a great circle. Flat maps stretch the regions near the poles, so a great circle appears as a curve bending towards the nearest pole. On a globe it would look straight.
Does altitude change the result?
This tool works on the surface of the Earth (or of the ellipsoid) and ignores altitude. For two points a few hundred metres above sea level the effect is negligible.
Related tools
- Angle Converter Convert angles between degrees, radians, gradians, turns, arcminutes and arcseconds, and switch between decimal degrees and degrees-minutes-seconds (DMS).
- Length Converter Convert length between mm, cm, metres, km, inches, feet, yards, miles and nautical miles, using exact definitions and a formula for each pair.
- Speed, Distance and Time Calculator Find the speed, the distance or the travel time from the other two, in km/h, mph, m/s or knots and km, miles, metres or nautical miles, with the steps.
- Time Zone Converter Convert a date and time from one time zone to several others at once, with daylight saving time handled automatically. Search any IANA time zone or city.