Latitude & Longitude Distance Calculator

Compute the great-circle distance between two locations on Earth.

Haversine great-circle distance

d = R · 2 · atan2(a, 1 − a)

Enter two latitude/longitude pairs

Point 1 — From

−90…90

−180…180

Point 2 — To

−90…90

−180…180

What is great-circle (Haversine) distance?

Latitude and longitude are angular coordinates on a sphere, not Cartesian coordinates on a flat plane. The shortest distance between two points on the surface of a sphere is an arc of a great circle — a circle whose plane passes through the centre of the sphere. The Haversine formula gives the length of that arc directly from the latitudes, longitudes, and Earth's radius without first projecting onto a 2-D map.

Treating lat/lon as Cartesian coordinates and plugging into the 2-D distance formula gives badly wrong answers, especially over long distances or at high latitudes. One degree of longitude is about 111 km at the equator but only 78 km at 45°N and zero at the poles. The Haversine formula bakes this changing scale into the math so the distance is correct everywhere on the globe.

How the lat/lng calculator works

Enter both coordinate pairs

Type the latitude and longitude of both points in decimal degrees. South latitudes and west longitudes are negative.

Pick a unit

Switch between kilometres, statute miles, and nautical miles — the great-circle distance is converted instantly.

Read distance and bearings

The result card shows the great-circle distance, the through-the-Earth chord, and the initial and final compass bearings.

Inspect the route on the map

An SVG world map highlights both points and draws the straight-line arc between them so you can sanity-check the answer visually.

Formulas inside this tool

Haversine — central angle

a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2)

Numerically stable for both small and large angular separations.

Haversine — arc length

c = 2 · atan2(√a, √(1−a)), d = R · c

R is Earth's mean radius, 6 371.0088 km.

Initial bearing

θ = atan2(sin Δλ · cos φ₂, cos φ₁ · sin φ₂ − sin φ₁ · cos φ₂ · cos Δλ)

Heading at the start point, measured clockwise from north.

Chord through the Earth

chord = 2R · sin(c/2)

Straight-line distance through the planet, not along the surface.

Where great-circle distance is used

Aviation

Commercial flight planning follows great-circle routes to minimise fuel burn. The unusually curved paths you see on flight tracker maps are great-circle arcs flattened onto a Mercator projection.

Shipping

Open-ocean navigation uses great-circle distance and the initial/final bearings to optimise routes between ports, modified only by weather and currents.

Telecommunications

Microwave and satellite link budgets depend on the great-circle distance between transmitter and receiver, plus elevation.

Mapping and GIS

Spatial databases like PostGIS evaluate distance queries on the sphere using Haversine for fast indexed nearest-neighbour searches.

Why use this calculator?

Haversine is short to write but slippery to compute by hand — the angles must be converted to radians, three trig functions must be evaluated, and the answer must be multiplied by Earth's radius. This calculator does all of that with full numerical stability and shows the bearings too, so you can both travel and orient yourself correctly.

Frequently Asked Questions

Latitude and longitude are angular coordinates on a sphere, so straight-line Euclidean distance does not apply. Instead, you use the great-circle distance — the shortest path along the surface of the Earth — which the Haversine formula computes exactly from the two angular pairs and Earth's radius.

Haversine: a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2), c = 2 · atan2(√a, √(1−a)), d = R · c. Here φ is latitude in radians, λ is longitude in radians, and R is Earth's mean radius — about 6 371 km. It is numerically stable even for very small or very large angular separations.

Latitudes and longitudes are angles, not Cartesian coordinates, and the spacing between them changes with latitude — 1° of longitude is ≈ 111 km at the equator but only ≈ 78 km at 45°N. Plugging them into √(Δφ² + Δλ²) gives wildly wrong answers, especially over long distances or at high latitudes.

Great-circle distance is the length of the shortest arc along the Earth's surface between two points. Straight-line (chord) distance is the length of a tunnel through the Earth between them. For short distances the two are nearly identical; for antipodal points the chord is the diameter of the Earth (≈ 12 742 km), and the great-circle distance is half the circumference (≈ 20 015 km).

The angle, measured clockwise from true north, that you would head along to travel directly toward a destination. Bearings range from 0° (N) through 90° (E), 180° (S), 270° (W) back to 360°. On a great-circle route the bearing changes continuously, which is why we report both an initial and a final bearing.

Within about 0.5% almost everywhere on Earth. It assumes the Earth is a perfect sphere; the planet is actually a slightly flattened ellipsoid. For sub-metre accuracy over thousands of kilometres, surveyors use Vincenty's formula on the WGS-84 ellipsoid; for everyday navigation, Haversine is more than enough.

You can switch between kilometres (km), statute miles (mi), and nautical miles (nm). 1 nautical mile = 1 852 m, and 1° of latitude is ≈ 60 nautical miles — the historic reason nm is the standard unit at sea and in aviation.

Convert to decimal degrees first: decimal = degrees + minutes/60 + seconds/3600. South latitudes and west longitudes get a minus sign. For example, 40°45'30"N becomes 40.7583, and 73°59'00"W becomes −73.9833.

Because a great-circle path curves on the spherical Earth, the heading you set out on (initial bearing) is generally different from the heading you would have at arrival (final bearing). On a long flight, the initial bearing might be 'north-east' even though the final bearing is 'south-east'.

No. The longest great-circle distance between any two points on Earth is exactly half the circumference, about 20 015 km. That is the distance to your antipodal point, the place on the opposite side of the world.