Distance Between Coordinates Calculator

Distance between two latitude and longitude points by Vincenty on WGS-84 and by haversine, with initial and final bearing, midpoint and DMS input.

The interactive tool loads here when JavaScript runs.

About this tool

What is the Coordinate Distance Calculator?

The distance between two GPS coordinates depends on the shape you assume for the Earth. The haversine formula treats it as a sphere and is accurate to about 0.5%. Vincenty's inverse formula works on the WGS-84 ellipsoid that GPS uses and is accurate to well under a millimetre for any pair of points it converges on. This calculator gives both, so you can see the difference for your route.

Type each point in decimal degrees (51.5074, -0.1278) or in degrees, minutes and seconds with hemisphere letters (37°57'03.72" S). You get the ellipsoidal distance in kilometres, miles, nautical miles, metres or feet, the haversine distance and its error, the initial bearing to set off on, the final bearing on arrival, and the great-circle midpoint.

Examples include London to New York and the Flinders Peak to Buninyong line that Geoscience Australia uses to test Vincenty implementations, which this calculator reproduces to the millimetre.

  • Vincenty inverse on the WGS-84 ellipsoid and haversine on the mean sphere
  • Decimal degree and DMS input with hemisphere letters
  • Initial and final bearings with compass points, and the midpoint
  • Kilometres, miles, nautical miles, metres and feet
  • Verified against the Geoscience Australia Vincenty test line
Read the guide: Haversine vs Vincenty: Measuring Distance Between Coordinates

How to use the Coordinate Distance Calculator

  1. Pick an example or type the latitude and longitude of point A and point B.
  2. Use decimal degrees with a minus sign for south and west, or DMS with N, S, E or W.
  3. Choose the distance unit: kilometres, miles, nautical miles, metres or feet.
  4. Read the Vincenty distance, the haversine comparison, both bearings and the midpoint.
  5. Use Swap to reverse the route, and Copy results to paste the full set into a report.

Worked examples

London to New York

Input

51.5074, -0.1278 to 40.7128, -74.0060

Output

Vincenty 5,585.234 km (3,470.5 mi, 3,015.8 nmi); haversine 5,570.230 km; initial bearing 288.37°, final 231.24°

The sphere is 15 km short, about 0.27%. The route leaves London heading west-north-west and arrives heading south-west, which is the curve of a great circle on a flat map.

Flinders Peak to Buninyong (Vincenty test line)

Input

37°57'03.72030" S, 144°25'29.52440" E to 37°39'10.15610" S, 143°55'35.38390" E

Output

54,972.271 m; initial bearing 306° 52′ 05.37″; reverse azimuth 127° 10′ 25.07″

These are the published results of Geoscience Australia's worked example, reproduced to the millimetre and the hundredth of a second.

New Delhi to Mumbai

Input

28.6139, 77.2090 to 19.0760, 72.8777

Output

Vincenty 1,144.53 km; haversine 1,148.10 km

On this north-south route near the tropics the sphere is 3.6 km too long, the opposite sign to the London example.

Background and insight

The haversine formula, a = sin²(Δφ/2) + cos φ1 cos φ2 sin²(Δλ/2) and d = 2R asin(√a), was popular in navigation tables because it stays well-conditioned for small distances, where the spherical law of cosines loses precision. The calculator uses R = 6,371,008.8 m, the IUGG mean radius (2a + b) / 3 of the WGS-84 ellipsoid. Because the real Earth is flattened by about 1 part in 298, a sphere overestimates distances along meridians near the equator and underestimates some east-west ones, with errors up to about 0.5%.

Thaddeus Vincenty published his iterative solution of the inverse geodetic problem in Survey Review in 1975. It iterates on the longitude difference on an auxiliary sphere until the change is below 1e-12 radians, then evaluates a series for the geodesic length. For nearly antipodal points the iteration can fail to converge; in that case the calculator says so and falls back to the haversine values. Charles Karney's 2013 algorithms (GeographicLib) solve that edge case and are the modern reference for survey software.

Common use cases

  • Survey and site checks

    Check the distance and bearing between two control points or GPS fixes before setting out.

  • Aviation and marine planning

    Get great-circle distance in nautical miles and the initial true course.

  • Data and GIS work

    Validate a haversine implementation in code against an ellipsoidal reference.

  • Logistics and travel

    Compare straight-line distances between depots, airports or customers.

Tips and limitations

  • Bearings are true, not magnetic. Apply the local magnetic declination before using a compass.
  • Distances are on the ellipsoid at sea level. Height differences and terrain add length that this calculation ignores.
  • Coordinates on a different datum (NAD27, ED50, older local grids) can be tens to hundreds of metres off WGS-84. Convert them first.
  • Five decimal places of a degree is about 1.1 m of latitude; six is about 0.11 m. Extra digits beyond your GPS accuracy add nothing.

Frequently asked questions

How do you calculate distance between two latitude and longitude points?

Convert both points to radians and apply the haversine formula d = 2R asin(√(sin²(Δφ/2) + cos φ1 cos φ2 sin²(Δλ/2))) with R = 6,371 km, or use Vincenty's formula on the WGS-84 ellipsoid for survey accuracy. This calculator shows both.

How accurate is the haversine formula?

It is exact on a sphere, but the Earth is an ellipsoid, so haversine distances differ from true geodesic distances by up to about 0.5%. Over 1,000 km that can be 3 to 5 km. Vincenty's method on WGS-84 is accurate to fractions of a millimetre.

What is the difference between initial and final bearing?

A great circle crosses each meridian at a different angle, so the direction you set off in (initial bearing) is not the direction you arrive in (final bearing). On short routes they are nearly equal; across an ocean they can differ by 50 degrees or more.

How do I convert degrees, minutes and seconds to decimal degrees?

Decimal degrees = degrees + minutes / 60 + seconds / 3600, made negative for south latitudes and west longitudes. 40° 26′ 46″ N is 40 + 26/60 + 46/3600 = 40.4461°. You can type either form into the calculator.

Why does Vincenty sometimes fail?

For points that are nearly on opposite sides of the Earth, the iteration in Vincenty's inverse formula can oscillate instead of converging. The calculator detects this and shows the haversine result instead; Karney's algorithm handles those cases exactly.

What Earth radius should I use for haversine?

6,371 km is the usual value; the IUGG mean radius of WGS-84 is 6,371.0088 km. Using the equatorial radius (6,378.137 km) makes every distance about 0.1% longer.

Is there an in-depth guide to the Coordinate Distance Calculator?

Yes. “Haversine vs Vincenty: Measuring Distance Between Coordinates” covers the background, how it works, common pitfalls and worked examples. Read the full guide.