How to Calculate Bearing Between Two Points (Formula)

Published

A bearing is the direction from one point to another, measured in degrees clockwise from north: 0° is north, 90° east, 180° south and 270° west. Given two pairs of latitude and longitude, you can calculate it with one formula. This guide shows the formula, works through New York to London by hand, and explains final bearings, back bearings, rhumb lines and the difference between true and magnetic north.

If you only need the answer, the bearing calculator does all of this from two points.

The initial bearing formula

The shortest route between two points on a globe follows a great circle. The direction you set off in along that route is the initial bearing (also called the forward azimuth). On a spherical Earth it is:

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

Work in radians (multiply degrees by π/180), convert the result back to degrees, and if it is negative add 360 so the bearing runs from 0° to 360°. Use the signed decimal degrees from your coordinates: south latitudes and west longitudes are negative. If you have degrees, minutes and seconds, convert them first with the DMS to decimal converter.

One trap: spreadsheets disagree on argument order. In JavaScript and Python it is atan2(y, x), but in Excel and Google Sheets it is ATAN2(x, y).

Worked example: New York to London

Start at New York City Hall, 40.712776, -74.005974, and end in central London, 51.507351, -0.127758.

  1. Difference in longitude: Δλ = -0.127758 − (-74.005974) = 73.878216°.
  2. The y part: sin(73.878216°) × cos(51.507351°) = 0.960674 × 0.622414 = 0.597937.
  3. The x part: cos(40.712776°) × sin(51.507351°) − sin(40.712776°) × cos(51.507351°) × cos(73.878216°) = 0.593269 − 0.112733 = 0.480536.
  4. θ = atan2(0.597937, 0.480536) = 51.21°.

So you leave New York heading a little east of northeast. The bearing calculator shows 51.24° for the same pair. The small difference is expected: the formula above treats the Earth as a sphere, while the calculator uses Vincenty's method on the WGS84 ellipsoid, which is slightly flattened. For navigation by hand the spherical result is more than good enough; for surveying, use an ellipsoidal method.

In Excel or Google Sheets, with the start latitude in B1, start longitude in C1, end latitude in B2 and end longitude in C2, the same formula is:

=MOD(DEGREES(ATAN2(COS(RADIANS(B1))*SIN(RADIANS(B2))-SIN(RADIANS(B1))*COS(RADIANS(B2))*COS(RADIANS(C2-C1)), SIN(RADIANS(C2-C1))*COS(RADIANS(B2)))), 360)

With the New York and London coordinates it returns 51.21. MOD(…, 360) turns a negative angle into the 0–360 range for you.

If the two longitudes are on opposite sides of the 180° meridian, the formula still works, because sine and cosine do not care whether Δλ is written as 350° or -10°.

Final bearing and back bearing

A great circle crosses each meridian at a different angle, so the bearing changes as you travel. When you arrive in London from New York you are no longer heading 51°, but 108.37° (east-southeast) according to the calculator. That is the final bearing.

To compute it, calculate the initial bearing from B back to A and add 180°:

final bearing (A→B) = initial bearing (B→A) + 180°, taken modulo 360

The back bearing is the direction to set off from B to return to A. It is the final bearing plus 180°: 108.37° + 180° = 288.37° (west-northwest). Notice that it is not 51.24° + 180° = 231.24°. Simply reversing the initial bearing only works over short distances.

Over a few kilometres, the change is negligible. From New York City Hall to the Statue of Liberty (40.689247, -74.044502), about 4.17 km away, the calculator gives an initial bearing of 231.27° and a final bearing of 231.24°: southwest, almost a straight line.

Great circle vs rhumb line

A rhumb line (loxodrome) is a path that crosses every meridian at the same angle, so you can follow it by holding one compass heading. On a Mercator map it appears as a straight line. The bearing is:

θ = atan2( Δλ , Δψ ), where Δψ = ln( tan(π/4 + φ2/2) / tan(π/4 + φ1/2) )

New York to London, the rhumb line bearing is 78.04° (east-northeast) for the whole trip. The catch is distance: about 5,794 km along the rhumb line against about 5,585 km along the great circle, roughly 200 km more. That is why long-haul flights and ships follow great circles and adjust their heading as they go, while short legs are often steered as rhumb lines. The distance calculator gives the great-circle distance for any two points.

From degrees to compass points

To turn a bearing into a compass direction, divide the circle into 16 points of 22.5° each and pick the nearest: divide the bearing by 22.5, round to the nearest whole number, and look it up (0 = N, 1 = NNE, 2 = NE, and so on up to 15 = NNW; 16 wraps back to N).

BearingBearing ÷ 22.5Compass point
51.24° (New York to London, initial)2.28 → 2NE, northeast
78.04° (rhumb line)3.47 → 3ENE, east-northeast
108.37° (final)4.82 → 5ESE, east-southeast
288.37° (back bearing)12.82 → 13WNW, west-northwest

Surveyors often write bearings in degrees, minutes and seconds instead: the calculator shows 51.24° as 51° 14' 29". You can convert with the same method as for coordinates, described in converting DMS to decimal by hand.

True north vs magnetic north

Every bearing calculated from latitude and longitude is a true bearing, measured from geographic north. A magnetic compass points to magnetic north instead. The angle between the two is the magnetic declination (or variation). It depends on where you are and changes over time.

The rule for converting is:

For example, with a hypothetical declination of 10° west, a true bearing of 51° becomes a compass bearing of 61°. Look up the current value for your location with NOAA's magnetic field calculators. NOAA's World Magnetic Model page notes that declination changes with location and time, and that the model is updated every five years.

Phones usually handle this for you: according to the same NOAA page, the World Magnetic Model comes pre-installed on Android and iOS devices. Our online compass reads your phone's sensors; keep it away from magnets and metal for a steady reading.

Common mistakes

Frequently asked questions

What is the formula for the bearing between two points?

The initial great-circle bearing is θ = atan2(sin Δλ · cos φ2, cos φ1 · sin φ2 − sin φ1 · cos φ2 · cos Δλ), where φ is latitude, λ is longitude and Δλ is the difference in longitude. Convert the result from radians to degrees and add 360 if it is negative.

Why is the bearing from A to B not the opposite of the bearing from B to A?

On a sphere the direction of a great circle changes as you travel along it. The bearing back from B to A is the final bearing at B plus 180°, not the initial bearing at A plus 180°. Over short distances the difference is tiny; over thousands of kilometres it can be tens of degrees.

Is a bearing measured from true north or magnetic north?

Bearings calculated from coordinates are true bearings, measured clockwise from geographic north. A magnetic compass points to magnetic north, so you need to correct for the local magnetic declination before following a calculated bearing with a compass.

What is the difference between a great-circle bearing and a rhumb line bearing?

A great-circle route is the shortest path, but its bearing changes along the way. A rhumb line keeps one constant bearing all the way, which is simpler to steer but longer. From New York to London the great-circle route starts at about 51° and the rhumb line is about 78°.