A bearing calculator tells you the compass heading and the shortest over-the-surface distance between any two geographic coordinates on Earth. Whether you are planning a hiking route, filing a flight plan, programming a drone waypoint, solving a surveying problem or satisfying curiosity about how far two cities are and in which direction — this tool gives you the answer in under a second, right in your browser.
How it works
The calculator uses two classic geodesy formulas applied to the WGS 84 spherical approximation of Earth (radius 6 371 km).
Haversine distance
The Haversine formula gives the great-circle distance between two points defined by latitude φ and longitude λ:
a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2)
c = 2 · arcsin(√a)
d = R · c (R = 6 371 km)
where Δφ = φ₂ − φ₁ and Δλ = λ₂ − λ₁, all in radians. The result is the shortest path along the curved surface — the great-circle distance — expressed in kilometres, miles and nautical miles.
Forward (initial) bearing
The initial bearing is the compass heading at the start point that points along the great-circle path toward the destination:
y = sin(Δλ) · cos φ₂
x = cos φ₁ · sin φ₂ − sin φ₁ · cos φ₂ · cos(Δλ)
θ = atan2(y, x) (radians)
bearing = (θ in degrees + 360) mod 360
The result is normalised to the range 0°–359° and then mapped to one of the 16 compass points (N, NNE, NE, ENE … each spanning 22.5°).
Back (final) bearing
The back bearing is the forward bearing computed in the reverse direction (B → A), then increased by 180° and normalised. This represents the heading at which you arrive at the destination — equivalently, the direction back to the origin.
Midpoint
The geographic midpoint on the great circle is found by:
Bx = cos φ₂ · cos(Δλ)
By = cos φ₂ · sin(Δλ)
φₘ = atan2(sin φ₁ + sin φ₂, √((cos φ₁ + Bx)² + By²))
λₘ = λ₁ + atan2(By, cos φ₁ + Bx)
Worked example: London to Paris
- Point A (London): 51.5074° N, 0.1278° W → (51.5074, −0.1278)
- Point B (Paris): 48.8566° N, 2.3522° E → (48.8566, 2.3522)
Plugging in:
- Δφ = −2.6508° = −0.04627 rad
- Δλ = 2.48° = 0.04328 rad
- a ≈ 0.001090
- c ≈ 0.06613 rad
- Distance ≈ 341 km (212 mi / 184 NM)
- Forward bearing ≈ 156° (SSE) — you head roughly south-southeast from London
This matches commercial flight data: the London-Heathrow to Paris-CDG route tracks between 150° and 160° depending on precise departure/arrival points.
Formula note
The Haversine formula was published by Roger Sinnott in Sky and Telescope (1984) as a numerically stable formulation specifically to avoid cancellation errors for small angular separations. It is accurate to well within 1% across all distances. For very high-precision geodesy (sub-metre accuracy over thousands of kilometres), the Vincenty iterative formula on the WGS 84 ellipsoid is preferred, but for navigation, hiking, drones and mapping applications the Haversine result is entirely sufficient.
Bearings are True bearings (measured from True North), not Magnetic bearings. To convert to Magnetic, subtract the local magnetic declination for your location and date (available from NOAA’s World Magnetic Model).