# 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.

- Calculator id: `compass-bearing` · Category: Time & Geography (`time`) · Tool name: `calculate_compass_bearing`
- Canonical page: https://tttkmbb.com/time/compass-bearing · This document: https://tttkmbb.com/time/compass-bearing.md · JSON definition: https://tttkmbb.com/time/compass-bearing.json

## Purpose

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.

**Use when:** 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).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `lat1` | number | ° | required | Latitude of start point in decimal degrees (north positive, south negative). (min -90, max 90) |
| `lon1` | number | ° | required | Longitude of start point in decimal degrees (east positive, west negative). (min -180, max 180) |
| `lat2` | number | ° | required | Latitude of destination in decimal degrees (north positive, south negative). (min -90, max 90) |
| `lon2` | number | ° | required | Longitude of destination in decimal degrees (east positive, west negative). (min -180, max 180) |

## Output

| Field | 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. |

## 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°).

## Data Sources

- Veness C – Calculate distance, bearing and more between latitude/longitude points (Movable Type Scripts) — https://www.movable-type.co.uk/scripts/latlong.html (reference, retrieved 2026-09-24)
- Points of the compass (Wikipedia) — https://en.wikipedia.org/wiki/Points_of_the_compass (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/compass-bearing?lat1=…&lon1=…&lat2=…&lon2=…`
- `POST https://tttkmbb.com/api/v1/calculate/compass-bearing` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/compass-bearing · OpenAPI operationId `calculate_compass_bearing` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "compass-bearing", "inputs": {…}}`

## Example

- Kansas City → St Louis: inputs `{"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: inputs `{"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
```

## Limitations

You only need the distance (use haversine-distance) or a bearing relative to magnetic north (apply the local magnetic declination separately). 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°). All values are computed from the formula above; no measurement or live data is involved.

## 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

- [Haversine Distance Calculator](https://tttkmbb.com/time/haversine-distance.md) — Distance, central angle and midpoint of the same route.
- [Coordinate Converter](https://tttkmbb.com/time/coordinate-converter.md) — Convert DMS coordinates to decimal degrees first.
- [Angle Converter](https://tttkmbb.com/conversion/angle.md) — Convert bearings between degrees, radians and mils.
