Math calculator

Great Circle Distance Calculator

The shortest path over a sphere, and the bearing along it.

Three formulas, side by side

Because their disagreement is the interesting part.

haversine, on a sphere of mean radius 6,371 km

343.556535 km

Which is 213.476068 miles, or 185.505756 nautical miles. The initial bearing is 148.1156° and the final bearing 150.0211° — a great circle does not hold a constant heading.

Haversine

343.556535 km

the answer — stable at short range

Law of cosines

343.556535 km

differs by 0 m

Equirectangular

343.603751 km

fast and deliberately crude

Miles

213.476068

statute miles

Nautical miles

185.505756

one per minute of arc

Initial bearing

148.1156°

from true north

Final bearing

150.0211°

it changes along the path

Midpoint

50.188595, 1.146618

halfway along the great circle

  • Computed with the haversine formula, which is numerically stable at short range because it works from the sine of a half-angle rather than from an inverse cosine.
  • The spherical law of cosines — the formula most references give — comes out identically here. It takes an arccos of a value very close to 1 for short distances, and acos has an unbounded derivative there, so it loses roughly half its significant digits: in double precision that is sub-millimetre at ten metres, and in the single precision these formulas were originally written for it was metres. Haversine avoids it by working from the sine of a half-angle instead. It is the same conditioning problem as taking the angle between two nearly-parallel vectors.
  • The equirectangular approximation shown is deliberately crude: it treats a patch of the globe as flat. It is fast, it is fine for sorting nearby results, and it is wrong by a growing margin away from the equator and over long distances.
  • The bearing CHANGES along a great circle — the initial and final bearings differ, sometimes greatly. A path of constant bearing is a rhumb line, which is longer and is what a Mercator map draws as a straight line.
  • This treats the Earth as a sphere of mean radius 6,371 km. It is actually an oblate spheroid, flattened by about a part in 300, so a spherical calculation can be off by up to roughly 0.5%. Vincenty’s formulae on the WGS-84 ellipsoid are the accurate alternative.

The shortest path is not a straight line on a Mercator map — that straight line is a rhumb line, and it is longer.

What this tool shows

The bearing changes as you travel a great circle — the initial and final headings differ, sometimes greatly. A path of constant bearing is a rhumb line, which is longer, and it is what a Mercator map draws as a straight line.

  • Great-circle distance between two coordinates
  • Initial and final bearings, which differ
  • The midpoint along the path
  • Why haversine rather than the law of cosines
  • When the equirectangular shortcut is good enough
  • Why a sphere is not the Earth
Distance and bearing Haversine km, miles, nautical Midpoint too

Three formulas shown, because they disagree in instructive ways.

Updated 7 September 2026 · Works in any browser, no installation

London to Paris is about 344 km. The great-circle distance is the shortest path over a sphere, and it is not what a straight line on a flat map shows. The bearing changes along the way, which is why long flights appear to curve on a Mercator projection.

At a glance

Formula shown
a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2), and the distance is 2R·atan2(√a, √(1−a)). The half-angle sines are what keep it accurate at short range, where an inverse cosine would not be.
Scenario support
Finding the distance between two cities; sorting places by proximity; working out a flight path or a great-circle bearing.
Educational estimate
Planning support from the values you enter — not professional advice.

Why the shortest path curves

On a flat surface the shortest path is a straight line. On a sphere there are no straight lines, and the shortest path is an arc of a great circle — a circle whose centre is the centre of the sphere.

The equator is one. So is every line of longitude. Lines of latitude other than the equator are not, which is why flying due east along the 50th parallel is not the shortest way to a place due east of you.

A flight from London to Tokyo goes near the North Pole, and on a Mercator map that looks like a detour. It is not: the map is what is distorted, and the great circle is genuinely shorter.

Any two points lie on exactly one great circle — except antipodal points, where infinitely many pass through both and there is no unique shortest path at all. This page flags that case, because every formula becomes ill-conditioned there.

Which formula to use

Three are in common use, and they are not equally good.

Haversine is the one to use. It computes from the sine of a half-angle, which stays accurate all the way down to metres. It is what this page reports.

The spherical law of cosines is what most references give, and it takes an arccos of a value very close to 1 for short distances. acos has an unbounded derivative there, so it loses roughly half its significant digits — in double precision that is sub-millimetre at ten metres, and in the single precision these formulas were originally written for it was metres. That is why haversine exists.

The equirectangular approximation treats a patch of the globe as flat. It is crude, it is very fast, and it is genuinely useful for sorting nearby results by proximity where the ordering matters more than the values. It degrades away from the equator and over distance.

All three are shown above so the differences are numbers rather than claims.

The bearing changes

Set off along a great circle on a heading of 90° and you will not still be heading 90° when you arrive. The bearing changes continuously.

It happens because the meridians converge towards the poles, so a path that keeps a constant angle to them is not a straight line on the sphere.

A path that does hold a constant bearing is a rhumb line. It is longer — sometimes much longer — and it is what a straight line on a Mercator map represents. That is the whole point of the Mercator projection: it was designed so navigators could draw a straight line and steer one heading, at the cost of distance.

This page reports both the initial and the final bearing, so the difference is visible. On a Sydney to Tokyo route they are tens of degrees apart.

The Earth is not a sphere

This page treats the Earth as a sphere of mean radius 6,371 km. It is not one.

It is an oblate spheroid, flattened at the poles by about a part in 300 — the equatorial radius is roughly 6,378 km and the polar radius about 6,357 km, a difference of some 21 km.

So a spherical calculation can be off by up to roughly 0.5%. Over 1,000 km that is about 5 km, which is fine for most purposes and not fine for surveying or aviation.

Vincenty’s formulae work on the WGS-84 ellipsoid and are accurate to millimetres. They are iterative, they converge slowly for nearly antipodal points, and they are what GPS and geodetic software use.

Which to choose is a real decision rather than a technicality. Sorting nearby restaurants does not need Vincenty; setting out a boundary does.

Where it gets used

Aviation and shipping. Flight planning is great-circle routing modified for wind and airspace, and the apparent curves on a route map are the shortest paths.

Location search. “Find the nearest” is a distance sort, usually done with the cheap approximation first and the accurate formula on the shortlist.

Radio and satellites. Antenna pointing and coverage footprints are great-circle calculations.

Geography and logistics. Service areas, delivery zones and the straight-line distances that road distances are compared against.

Sources and methodology

The formulas and the ellipsoid model are standard; these are the references.

Method. Haversine is the reported answer because it is numerically stable at short range: it works from the sine of a half-angle rather than from an inverse cosine. The spherical law of cosines is computed alongside and the disagreement is measured and stated, rather than the page simply asserting that one is better — in double precision that gap is sub-millimetre at ten metres, and claiming metres of error would have been the easier sentence and the wrong one. The suite verifies every distance against an independent vector dot-product derivation. That engine is verified on every change against 99 hand-written assertions, including that haversine matches an independent vector derivation on every city pair tested, that distance is symmetric across five hundred generated coordinate pairs, and that no distance exceeds half the circumference. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

DistanceThe distance between two points in the plane or in space, kept exact as a surd wherever the square root does not come out — √50 stays √50, and is also shown as 5√2.
Polar CoordinatesCartesian to polar and back, in two dimensions or three — with the angle from atan2, so a point in a left-hand quadrant is not reported 180° away from where it is.
VectorMagnitude, unit vector, sum, both products and the projection — with parallelism decided on the cross product, so exactly parallel vectors return exactly 0° and not a millionth of a degree.
Trigonometric FunctionsAll six functions at once with exact surd values at the sixteen special angles — and tan 90° reported as undefined rather than as the 1.6 × 10¹⁶ a double returns.
Angle Between Two VectorsDot product, magnitudes and the angle as separate steps, in the plane or in space — with exactly parallel vectors returning 0° rather than a floating-point smudge.
SphereVolume, surface area, hemisphere figures and the surface-to-volume ratio — the one number that explains why cells are small and why crushed ice cools faster.

More in Math, or browse all calculators.

Read the guide

The same inverse-cosine conditioning problem appears when taking the angle between two nearly-parallel vectors — the Vector Calculator handles it the same way.

Educational use disclaimer

This is an educational tool. It models the Earth as a sphere of mean radius 6,371 km; the actual oblate shape means a spherical result can be off by up to roughly 0.5%.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 7 September 2026

  1. Published the great-circle page computing three formulas and showing them together, since their disagreement is the content — haversine is the answer, the law of cosines is what most references give, and the equirectangular approximation is deliberately crude and useful anyway.
  2. States the law-of-cosines degradation honestly rather than dramatically: in double precision it is sub-millimetre at ten metres, and it was metres in the single precision these formulas were originally written for. Overstating it would have been the easier sentence.
  3. Reports both the initial and final bearing, because a great circle does not hold a constant heading — that is a rhumb line, which is longer and is what a Mercator map draws as a straight line.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.