HomeTime & Geography › Compass Bearing Calculator

Compass Bearing Calculator

Computes the initial (forward) and final bearing of the great-circle route between two latitude/longitude points, the back bearing for the return trip, the matching 16-point compass directions and the distance.

When to use

You need the heading from one coordinate to another for navigation, antenna or solar alignment, or want a bearing expressed as a compass point such as NNE.

Do not use when: You only need the distance (use haversine-distance) or a bearing relative to magnetic north (apply the local magnetic declination separately).

Formula

θ_initial = atan2(sin Δλ · cos φ2, cos φ1 · sin φ2 − sin φ1 · cos φ2 · cos Δλ) mod 360; θ_final = (θ_initial(point 2 → point 1) + 180) mod 360; compass point = round(θ / 22.5) mod 16

Bearings are relative to true north on a spherical Earth. The 16-wind compass rose assigns 22.5° sectors centred on each point (N = 348.75°–11.25°).

Inputs

ParameterTypeUnitRequiredDescription
lat1number°yesLatitude of start point in decimal degrees (north positive, south negative). Range: ≥ -90, ≤ 90
lon1number°yesLongitude of start point in decimal degrees (east positive, west negative). Range: ≥ -180, ≤ 180
lat2number°yesLatitude of destination in decimal degrees (north positive, south negative). Range: ≥ -90, ≤ 90
lon2number°yesLongitude of destination in decimal degrees (east positive, west negative). Range: ≥ -180, ≤ 180

Outputs

OutputTypeUnitDescription
initial_bearing_degreesnumber°Heading at the start point, clockwise from true north (0–360).
initial_compass_pointstring16-point compass direction of the initial bearing.
final_bearing_degreesnumber°Heading on arrival at the destination.
final_compass_pointstring16-point compass direction of the final bearing.
back_bearing_degreesnumber°Initial bearing of the return route (final bearing + 180°).
distance_kmnumberkmGreat-circle distance (haversine, R = 6371.0088 km).
distance_milesnumbermiSame distance in statute miles.

Example

Kansas City → St Louis: {"lat1":39.099912,"lon1":-94.581213,"lat2":38.627089,"lon2":-90.200203}{"initial_bearing_degrees":96.51,"initial_compass_point":"E (east)","final_bearing_degrees":99.26,"back_bearing_degrees":279.26,"distance_km":382.9}

Movable Type example: 50°03′59″N 5°42′53″W → 58°38′38″N 3°04′12″W: {"lat1":50.06639,"lon1":-5.71472,"lat2":58.64389,"lon2":-3.07}{"initial_bearing_degrees":9.12,"initial_compass_point":"N (north)","final_bearing_degrees":11.28,"final_compass_point":"NNE (north-northeast)","back_bearing_degrees":191.28,"distance_km":968.85}

GET https://tttkmbb.com/api/v1/calculate/compass-bearing?lat1=39.099912&lon1=-94.581213&lat2=38.627089&lon2=-90.200203

Machine access

Sources

FAQ

Why do the initial and final bearings differ?

A great circle is not a line of constant heading: except along the equator or a meridian, the heading drifts as you travel. The difference grows with distance and latitude.

Is this a magnetic bearing?

No, it is relative to true north. Subtract the local magnetic declination (east positive) to obtain a magnetic compass heading.

Related calculators