trigonometry calculators

Bearing and Navigation Calculator

Finds the compass bearing and great-circle direction between two geographic coordinates. Use it for route planning, surveying, or any navigation task where you need the precise heading from one point to another.

About this calculator

The forward bearing between two points on a sphere is calculated using the spherical law of cosines combined with the atan2 function. The formula is: θ = atan2(sin(Δλ)·cos(φ₂), cos(φ₁)·sin(φ₂) − sin(φ₁)·cos(φ₂)·cos(Δλ)), where φ is latitude in radians and λ is longitude in radians. The raw result from atan2 is in radians and is converted to degrees by multiplying by 180/π. Because atan2 returns values in the range −180° to +180°, a modulo operation normalises the result to a standard 0°–360° compass bearing. True bearing is measured clockwise from north, so 0° is north, 90° is east, 180° is south, and 270° is west. This formula assumes a perfectly spherical Earth; for high-precision geodesy, the WGS-84 ellipsoid model (Vincenty's formulae) would be used instead.

How to use

Suppose you want the bearing from New York (40.7128° N, −74.0060° W) to London (51.5074° N, −0.1278° W). Enter startLat = 40.7128, startLng = −74.0060, endLat = 51.5074, endLng = −0.1278. The calculator converts all values to radians, then applies: θ = atan2(sin(−0.1278 − (−74.0060) in rad)·cos(51.5074 in rad), cos(40.7128 in rad)·sin(51.5074 in rad) − sin(40.7128 in rad)·cos(51.5074 in rad)·cos(Δλ)). The result, normalised to 0–360°, is approximately 51.2°, meaning you must head roughly north-northeast to travel from New York to London.

Frequently asked questions

What is the difference between true bearing and magnetic bearing in navigation?

True bearing is measured clockwise from geographic (true) north, which is the direction toward the North Pole. Magnetic bearing is measured clockwise from magnetic north, which shifts over time and varies by location. The difference between them is called magnetic declination. This calculator outputs true bearing; to convert to magnetic bearing, add or subtract your local declination value. Declination data is published by national geological surveys and changes slightly each year.

Why does the bearing formula use atan2 instead of a simple arctangent?

The standard arctangent (atan) function only returns values in the range −90° to +90°, which means it cannot distinguish quadrants correctly for all compass directions. The atan2(y, x) function accepts two separate arguments and returns a result in the full range −180° to +180°, correctly resolving the quadrant in all cases. This is essential for navigation because a heading of 30° (NNE) and 210° (SSW) would otherwise produce the same tangent ratio. Using atan2 guarantees an unambiguous bearing for any pair of coordinates on the globe.

How accurate is the spherical bearing formula for real-world navigation?

For most practical purposes—hiking, sailing, general aviation—the spherical formula is accurate to within about 0.3% of the true geodesic distance. The Earth is actually an oblate spheroid slightly flattened at the poles, so the spherical model introduces a small error that grows with distance and latitude. For distances under a few hundred kilometres the error is negligible. High-precision applications such as surveying or missile guidance use Vincenty's formulae or similar ellipsoidal models to achieve sub-millimetre accuracy.