Great Circle Distance Calculator

Stephanie Ben-Joseph headshot Stephanie Ben-Joseph

Introduction to great-circle distance between two coordinates

A great circle is the intersection of a sphere with a plane through its centre; it is the largest circle that can be drawn on that sphere. Any two points on a sphere that are not antipodal lie on exactly one great circle, and the shorter of the two arcs between them is the shortest possible path across the surface. That arc length is the great-circle distance, and it is the quantity this calculator returns.

Great-circle distance is the working currency of long-range navigation. Flight planning systems build long-haul routes around it before layering on airway structure, oceanic tracks and wind optimisation; shipping departments use it to compare voyage options; radio and submarine-cable engineers use it to size path loss and cable length; and spatial analysts use it whenever a straight line drawn on a projected map would be badly misleading.

What makes the number interesting is that it is not the distance you would measure with a ruler on a Mercator chart. Mercator preserves angles, not distances, so the shortest real path between New York and London appears on that projection as a curve bowing north across the Atlantic. The great-circle distance is the length of that curve, and it is consistently shorter than the straight-looking line on the paper.

This tool computes the arc on a sphere with the haversine formula, reports it in kilometres, statute miles and nautical miles, gives the initial and final true bearings along the route, and cross-checks the spherical answer against the Vincenty inverse geodesic on the WGS 84 ellipsoid so you can see exactly how much the spherical approximation costs you on your particular pair of points.

How to use this tool with decimal degrees or DMS coordinates

Enter latitude and longitude for point A and point B. Each of the four boxes accepts either format:

A hemisphere letter and a minus sign together are contradictory, so -74.006 W is rejected rather than guessed at. Latitude must lie within ±90°; anything outside that range is a data-entry error and the calculator says so instead of silently clamping the value to the pole. Longitude outside ±180° is legitimate shorthand — 200° east is the same meridian as −160° — so it is wrapped rather than rejected, and the wrapped value is shown back to you.

Choose the Earth model beneath the coordinate boxes. The default is the IUGG and NGA arithmetic mean sphere; the equal-area and equal-volume spheres and a custom radius are also available, the last of which lets you run the same geometry on the Moon (1737.4 km) or Mars (3389.5 km). Press Calculate great-circle distance. The result panel reports the distance in three units, the central angle, both bearings, and the WGS 84 geodesic for comparison; the table underneath breaks the same route down by method so you can see the spread.

The haversine formula and the central angle

The haversine is an old navigational function, defined as half the versed sine of an angle. Sinnott popularised its modern floating-point use, but the function itself dates from nineteenth-century sight-reduction tables, where it earned its place because it is never negative and its logarithm is therefore always defined:

hav(θ) = sin2 (θ2) = 1cosθ2

All angles below are in radians. Using

the intermediate quantity a is the haversine of the central angle:

a = sin 2 ( Δφ 2 ) + cos ( φ1 ) cos ( φ2 ) sin 2 ( Δλ 2 )

Geometrically, a is the squared half-chord between the two points expressed on a unit sphere, so it always lies between 0 and 1. The central angle c, the angle the arc subtends at the centre of the Earth, is recovered with a two-argument arc tangent rather than an arc sine or arc cosine, because atan2 stays well conditioned across the whole range from coincident points to antipodes:

c = 2 · atan2 ( a , 1a )

Because the arc is a fraction of a full circle of radius R, the surface distance d is simply the central angle multiplied by the radius:

d=Rc

The two unit conversions applied to d are exact by definition, not approximations: one international mile is 1.609344 km and one nautical mile is 1852 m, both listed as exact in NIST Special Publication 811, Appendix B.8. A great-circle calculator that multiplies kilometres by a rounded 0.621371 loses about one part in two million, which is small but entirely avoidable.

Why the spherical law of cosines fails in double precision

Textbooks often give a shorter-looking route to the same central angle, the spherical law of cosines:

c=arccos ( sinφ1 sinφ2 + cosφ1 cosφ2 cosΔλ )

In exact arithmetic the two expressions are identical. In IEEE 754 double precision they are not. For nearby points the bracketed argument tends to 1, and doubles are spaced about 2.2 × 10−16 apart near 1, so the argument retains almost no significant digits. The arc cosine then amplifies the damage, because its derivative diverges at 1. Take two points 0.000001° of latitude apart at 51.5° N: the true separation on the mean sphere is 111.1951 mm, and the law of cosines returns 134.2590 mm — an error of 20.7 percent on a sub-metre baseline. Move the points closer and the argument eventually rounds to exactly 1, at which point the formula reports a distance of zero for two genuinely distinct locations. Feed it a value that rounds a hair above 1 without a clamp and acos returns NaN.

The haversine formula avoids all of this because it never forms a quantity close to 1: it works with the sine of half the difference, which is itself small when the points are close, so relative precision is preserved. This calculator uses haversine for the headline answer and shows the law-of-cosines value in the method table purely so that the failure is visible rather than hypothetical. Where the law of cosines is evaluated, its argument is clamped to [−1, 1] so it can never emit NaN.

Initial and final bearing along a great circle

Except along the equator or a meridian, a great circle is not a constant-heading path. It crosses each successive meridian at a slightly different angle, so the true course changes continuously along the route. Conflating the two ends is a common and consequential error. The initial bearing — the course to steer on departure from A — is

θi= atan2( sinΔλ cosφ2 , cosφ1 sinφ2 sinφ1 cosφ2 cosΔλ )

and the final bearing — the course you are actually flying or steaming as you arrive at B — is obtained by running the same expression backwards from B to A and reversing it:

θf= (θi(BA)+180°) mod360°

Both are reduced to the compass range 0° to 360°, measured clockwise from true north — not magnetic north, which requires a separate declination correction from a magnetic model such as the NOAA/NCEI World Magnetic Model. For a pair of antipodal points every great circle through them is equally short, so no bearing is defined at all and the calculator says so rather than printing an arbitrary number.

Interpreting the result you get

The headline number is the shortest distance over the surface of the chosen reference figure between the two coordinates. Several things follow from that:

A practical rule for sanity-checking a result: one degree of central angle is 111.195 km on the mean sphere, and one arcminute is 1.853 km — which is why the nautical mile was defined as one minute of arc in the first place, and why nautical miles and central angle stay so close on this page.

Worked example: New York City to London, step by step

Take the two city-centre coordinates in decimal degrees, on the default IUGG mean sphere with R = 6371.0087714 km:

  1. Convert to radians: φ1 = 0.71057241, φ2 = 0.89897372, Δφ = 0.18840131, Δλ = 1.28941784.
  2. First haversine term: sin2φ/2) = 0.0088475467.
  3. Second term: cos φ1 · cos φ2 · sin2λ/2) = 0.1703888868.
  4. Sum: a = 0.1792364335, so √a = 0.4233632406 and √(1 − a) = 0.9059600248.
  5. Central angle: c = 2 · atan2(0.4233632406, 0.9059600248) = 0.8743089279 rad = 50.094212°.
  6. Distance: d = 6371.0087714 × 0.8743089279 = 5570.2298 km.

Converting exactly: 5570.2298 ÷ 1.609344 = 3461.180 statute miles, and 5570229.8 ÷ 1852 = 3007.684 nautical miles. The initial bearing is 51.2126° (north-east) and the final bearing is 108.3297° (east-south-east) — a swing of 57 degrees across the crossing, which is exactly why the route looks bent on a Mercator chart and why a constant-heading rhumb line is a different path.

Running the same pair through the Vincenty inverse solution on the WGS 84 ellipsoid gives 5585.2336 km, with an initial azimuth of 51.2412° and a final azimuth of 108.3690°. The sphere is therefore 15.00 km short, or 0.269 percent low, and the azimuths differ by about 0.03 degrees. For a route brief that is immaterial; for a cable procurement contract it is 15 km of cable.

Note how badly a five-digit answer would mislead here. The older version of this page quoted “roughly 5,580–5,600 km, or about 3,470 miles” for this route. The correct spherical value is 5570.23 km / 3461.18 mi and the correct ellipsoidal value is 5585.23 km / 3470.50 mi; the quoted range straddled the two models without matching either.

Choosing an Earth radius: R1, R2 and R3

“The radius of the Earth” is not a single number, because the Earth is not a sphere. WGS 84 defines an ellipsoid of revolution with semi-major axis a = 6378137.0 m exactly and reciprocal flattening 1/f = 298.257223563, from which the semi-minor axis b = 6356752.3142 m. Three different spheres are commonly derived from it, and NIMA TR8350.2 Table 3.3 lists all three. The arithmetic mean of the semi-axes is

R1= 2a+b3 =6371008.7714m

and the radius of the sphere with the same volume as the ellipsoid is

R3= a2b3 =6371000.7900m

The third, the radius of the sphere of equal surface area, is R2 = 6371007.1809 m. The spread between the three is under 8 m of radius, which moves a 5570 km answer by about 7 m — utterly negligible next to the roughly 15 km sphere-versus-ellipsoid difference on the same route. The familiar rounded value 6371 km sits 8.8 m below R1 and is fine for anything but bookkeeping-level reproducibility. What matters far more than which mean radius you pick is that the page tells you which one it used, so that another tool's answer can be reconciled with yours.

From sphere to ellipsoid: the Vincenty inverse geodesic

On an ellipsoid the shortest path is no longer a circular arc but a geodesic, and it has no closed-form length. Vincenty (1975) gave a compact iterative inverse solution built on nested equations for the elliptic terms; his equations (13) to (21) are what this page implements. The iteration solves for λ, the longitude difference on an auxiliary sphere, and the distance then follows from

s=bA (σΔσ)

where σ is the angular distance on the auxiliary sphere and A and Δσ are series in u2 = cos2α (a2b2)/b2. Vincenty reports a maximum disagreement of 0.01 mm against independent meridional-arc checks, and notes that inverse distances rounded to the millimetre may be in error by up to 0.5 mm.

Two independent checks confirm the implementation on this page. A quarter of the equator, from 0°N 0°E to 0°N 90°E, returns 10018.7542 km, which is πa/2 to the last digit shown. A pole-to-pole line returns 20003.9315 km, exactly twice the accepted WGS 84 meridian quadrant of 10001.9657 km. Neither of those numbers can be reproduced by a spherical formula, which gives 10007.5572 km and 20015.1144 km respectively.

Vincenty's own paper states the method's one failure mode plainly: “The inverse formula may give no solution over a line between two nearly antipodal points. This will occur when λ, as computed by eqn. (11), is greater than π in absolute value.” This page detects that condition, and a stalled iteration, and reports the geodesic as non-convergent instead of printing whatever the last iterate happened to be. Karney (2013) gives a modern replacement that converges for every pair of points, including antipodal ones, and is accurate to round-off; if you need a guaranteed answer near antipodes, that is the algorithm to reach for.

Great circle versus rhumb line

In navigation, a great circle route is not the only possible path between two points. Another important path type is the rhumb line (or loxodrome), which crosses all meridians at a constant bearing. The two differ in several ways:

Aspect Great circle route Rhumb line route
Definition Shortest path between two points on the surface of a sphere Path that keeps a constant compass bearing
Distance Minimal possible surface distance Longer than the great circle distance (except along meridians or the equator)
Navigation complexity Requires changing bearing over the course of the journey Simpler steering with a fixed heading
Common uses Long-range flights, ocean crossings, geodesy Traditional marine navigation, simple chart work
Appearance on Mercator maps Curved line between points Straight line between points

This calculator returns great-circle distance, not rhumb-line distance. On the New York to London pair the rhumb line runs 5794.13 km against 5570.23 km for the great circle, so the convenience of a fixed heading costs 4.0 percent in distance. On short legs the two converge and the difference stops mattering.

Where great-circle distance is actually used

Method comparison for one reference route

All five rows below are the same New York to London pair, differing only in method or reference figure. The deltas are measured against the WGS 84 geodesic, which is the most defensible of the five.

Method and reference figure Distance (km) Delta vs geodesic (km) Delta (%)
Haversine, IUGG mean sphere R1 = 6371.0087714 km 5570.2298 −15.0037 −0.269
Haversine, equal-area sphere R2 = 6371.0071809 km 5570.2285 −15.0051 −0.269
Haversine, equal-volume sphere R3 = 6371.0007900 km 5570.2229 −15.0107 −0.269
Haversine, rounded sphere R = 6371 km 5570.2222 −15.0114 −0.269
Vincenty inverse geodesic, WGS 84 ellipsoid 5585.2336 0.0000 0.000

The lesson is that the choice of mean radius changes the answer by metres while the choice between sphere and ellipsoid changes it by kilometres. Arguing about the fourth decimal place of R while ignoring flattening is a common misallocation of effort.

Limitations, assumptions and the error budget

Every number on this page rests on assumptions that are worth stating explicitly.

Frequently asked questions about great-circle distance

Is the great-circle distance the same as the distance an airliner actually flies?

No. The great-circle distance is the shortest path across an idealised sphere. A real flight adds departure and arrival manoeuvres, airway and airspace routing, oceanic track structures and wind-optimised deviations, so the flown track is normally 1 to 5 percent longer, and considerably longer when weather or overflight restrictions force a detour.

Which Earth radius does this calculator use, and does the choice matter?

The default is the arithmetic mean radius of the three WGS 84 semi-axes, R1 = (2a + b) / 3 = 6371.0087714 km, listed in NIMA TR8350.2 Table 3.3. You can switch to the equal-area sphere R2 = 6371.0071809 km, the equal-volume sphere R3 = 6371.0007900 km, or a custom radius. The three standard spheres differ by under 8 metres of radius, which moves the New York to London answer by about 7 metres out of 5570 km.

Why does this calculator use the haversine formula rather than the spherical law of cosines?

The two are algebraically equivalent but not numerically equivalent. The law of cosines takes the arc cosine of a quantity that approaches 1 for nearby points, and in IEEE 754 double precision that argument loses almost all of its significant digits. For two points separated by 0.000001 degrees of latitude at 51.5 degrees north the true separation is 111.1951 mm, and the law of cosines returns 134.2590 mm, an error of 20.7 percent; closer still, the argument rounds to exactly 1 and the formula returns zero. Haversine works with the sine of half the differences, so the small quantity stays small and the result stays accurate at every separation.

Why do the initial and final bearings of a great-circle route differ?

Except along the equator or a meridian, a great circle crosses successive meridians at a continuously changing angle, so the true course changes along the route. The initial bearing is the course to steer when leaving point A and the final bearing is the course you are on when arriving at point B. From New York to London they are 51.2126 and 108.3297 degrees on the sphere. Holding the initial bearing as a fixed heading produces a rhumb line instead, which is a different and longer path.

How are the poles, the 180th meridian and antipodal points handled?

Latitudes of exactly plus or minus 90 degrees are accepted, and at a pole the longitude has no effect on the geometry. The longitude difference is wrapped into the range minus 180 to plus 180 degrees before the haversine terms are formed, so crossing the 180th meridian is not mistaken for a trip nearly all the way around the world. Identical points return exactly zero. For antipodal and near-antipodal points every great circle through them has the same length, so no bearing is unique, and the Vincenty ellipsoidal solution is reported as non-convergent rather than forced to a wrong number.

How much error does treating the Earth as a sphere introduce?

For long intercontinental routes the spherical answer is usually within about 0.3 percent of the WGS 84 geodesic: New York to London is 5570.23 km on the mean sphere against 5585.23 km on the ellipsoid, a shortfall of 15.00 km. The largest relative errors appear on short lines, where the sphere replaces the local radius of curvature: a short north-south line on the equator comes out about 0.56 percent too long, and a short line near a pole about 0.45 percent too short. Switch to the ellipsoidal geodesic whenever the number feeds survey, legal or engineering work.

Sources. Ellipsoid and sphere constants: National Imagery and Mapping Agency, Department of Defense World Geodetic System 1984: Its Definition and Relationships with Local Geodetic Systems, NIMA TR8350.2, Third Edition, 4 July 1997 (Amendment 1, 3 January 2000) — Table 3.1 gives the defining parameters a = 6378137.0 m and 1/f = 298.257223563; Table 3.3 gives b = 6356752.3142 m, R1 = 6371008.7714 m, R2 = 6371007.1809 m and R3 = 6371000.7900 m. Ellipsoidal geodesic: T. Vincenty, “Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations”, Survey Review 23(176), April 1975, 88–93, hosted by the NOAA National Geodetic Survey — inverse equations (13)–(21) and the stated non-convergence for nearly antipodal lines. Modern alternative: C. F. F. Karney, “Algorithms for geodesics”, Journal of Geodesy 87(1), January 2013, 43–55. Exact unit conversions (1 international mile = 1.609344 m × 103; 1 nautical mile = 1852 m): NIST Special Publication 811, Appendix B.8. The haversine and bearing identities are standard spherical trigonometry and are reproduced above in full so they can be checked directly.

Point A Decimal degrees (40.7128) or DMS (40° 42′ 46″ N). North positive, south negative. Range −90 to 90. Decimal degrees (−74.0060) or DMS (74° 00′ 21″ W). East positive, west negative.
Point B Decimal degrees, DMS, or degrees and decimal minutes (51 30.444 N). Decimal degrees, DMS, or degrees and decimal minutes (0 07.668 W).
Reference figure Radii R1, R2 and R3 are the WGS 84 derived constants in NIMA TR8350.2 Table 3.3. The WGS 84 ellipsoidal geodesic is always reported alongside, whichever sphere you pick. Used only when “Custom sphere radius” is selected. Moon 1737.4, Mars 3389.5. Must be greater than 0 and at most 1,000,000 km.

Enter two coordinate pairs to compute a great-circle distance.

Nothing has been calculated yet, so no distance is shown.

Your route by method

Calculate a distance above and this table fills in with the same route evaluated four ways, so you can see how much the model choice is worth on your coordinates.

Great-circle and geodesic distance for the entered route, by calculation method
Method Distance (km) Distance (nmi) Delta vs geodesic
No route calculated yet.

Mini-game: Jetstream Jockey

Feel why the shortest route bends on a flat map: ride the live great-circle lane, dodge storm cells, and scoop tailwind rings before the clock runs out.

Click to Play

Thread the bright arc, surf the tailwinds, and keep your aircraft hugging the true shortest path.

RouteNYC → London
Score0
Best0
Time75.0s

Controls: press the upper half of the canvas to climb north, press the lower half to dip south. Keyboard fallback: ↑ and ↓.

Compute a route above to update the flight lane. The game pauses automatically if the tab loses focus.