geoprimsField-grade geospatial math

Difference between two bearings

The smallest signed turn from one bearing to another, across north when needed.

20°

Turn 20° right.

Provenance
Computed by
geodesy.parse.bearing-difference 1.0.0, core 0.1.0
Model
Exact remainder: ((to − from + 180) mod 360) − 180
Accuracy
Exact
Notes
None
Cites
International Organization for Standardization, Geographic Point Location, ISO 6709

Something look off?

Your values

Showing an example. Change anything.
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: Exact remainder: ((to − from + 180) mod 360) − 180

Accuracy: Exact

When to use this: Use this for the turn between two headings or bearings when one of them may be on the other side of north: a course change, the angle between two legs, the correction from a heading flown to a heading wanted. It gives the short way round, signed, instead of the long way a plain subtraction gives.

Limitations: The answer is the smaller of the two ways round, so it is never more than half a turn: if you need the actual turn a vehicle made through 200 degrees, this is not it. A difference of exactly 180 degrees comes out as minus 180 rather than plus 180, which falls out of the expression the tool states rather than being a choice about which way to turn -- at a reversal there is no shorter way. This is plane angle arithmetic and knows nothing about magnetic or true north; converting between those is the declination tool.

Worked example: From 350° to 010°. Source: add-geodesy-suite scenario: +20°. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.

You enter

From bearing
350 deg
To bearing
10 deg

You get

Difference
20°

Review: Not yet independently reviewed by a geodesist.

Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Checked against: 23 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources