Home › Time & 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
lat1 | number | ° | yes | Latitude of start point in decimal degrees (north positive, south negative). Range: ≥ -90, ≤ 90 |
lon1 | number | ° | yes | Longitude of start point in decimal degrees (east positive, west negative). Range: ≥ -180, ≤ 180 |
lat2 | number | ° | yes | Latitude of destination in decimal degrees (north positive, south negative). Range: ≥ -90, ≤ 90 |
lon2 | number | ° | yes | Longitude of destination in decimal degrees (east positive, west negative). Range: ≥ -180, ≤ 180 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
initial_bearing_degrees | number | ° | Heading at the start point, clockwise from true north (0–360). |
initial_compass_point | string | 16-point compass direction of the initial bearing. | |
final_bearing_degrees | number | ° | Heading on arrival at the destination. |
final_compass_point | string | 16-point compass direction of the final bearing. | |
back_bearing_degrees | number | ° | Initial bearing of the return route (final bearing + 180°). |
distance_km | number | km | Great-circle distance (haversine, R = 6371.0088 km). |
distance_miles | number | mi | Same 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
- API:
GET https://tttkmbb.com/api/v1/calculate/compass-bearing(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/compass-bearing · Markdown: https://tttkmbb.com/time/compass-bearing.md · JSON definition: https://tttkmbb.com/time/compass-bearing.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="compass-bearing" - OpenAPI operationId:
calculate_compass_bearing - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
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
- Haversine Distance Calculator — Distance, central angle and midpoint of the same route.
- Coordinate Converter — Convert DMS coordinates to decimal degrees first.
- Angle Converter — Convert bearings between degrees, radians and mils.