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 Δλ )
- φ1, φ2: latitude of the start and end point
- Δλ: longitude of the end point minus longitude of the start point
- atan2(y, x): the two-argument arctangent found in every spreadsheet and programming language. It returns an angle in the correct quadrant, which a plain arctangent cannot do.
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.
- Difference in longitude: Δλ = -0.127758 − (-74.005974) = 73.878216°.
- The y part: sin(73.878216°) × cos(51.507351°) = 0.960674 × 0.622414 = 0.597937.
- The x part: cos(40.712776°) × sin(51.507351°) − sin(40.712776°) × cos(51.507351°) × cos(73.878216°) = 0.593269 − 0.112733 = 0.480536.
- θ = 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).
| Bearing | Bearing ÷ 22.5 | Compass point |
|---|---|---|
| 51.24° (New York to London, initial) | 2.28 → 2 | NE, northeast |
| 78.04° (rhumb line) | 3.47 → 3 | ENE, east-northeast |
| 108.37° (final) | 4.82 → 5 | ESE, east-southeast |
| 288.37° (back bearing) | 12.82 → 13 | WNW, 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:
- East declination: magnetic bearing = true bearing − declination.
- West declination: magnetic bearing = true bearing + declination.
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
- Forgetting radians. Most software trig functions expect radians, not degrees.
- Using atan instead of atan2. A plain arctangent cannot tell northeast from southwest.
- Dropping the minus sign on a west longitude or south latitude, which points the bearing somewhere else entirely.
- Reversing the initial bearing to get the way back over long distances. Use the final bearing plus 180°.
- Mixing true and magnetic bearings without applying the declination.