Initial bearing calculator
Leaving London for Paris along the great circle, you set off on a bearing of 148.115617°, labelled SSE on the 16-point compass. Enter origin and destination in decimal degrees for a heading you can draw as an arrow or a bearing line. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Lat1
- 51.5074
- Lng1
- -0.1278
- Lat2
- 48.8566
- Lng2
- 2.3522
- Bearing
- 148.115617 deg
- Cardinal
- SSE
When you need the compass direction from one point on Earth to another, the initial bearing is the answer: the forward azimuth of the great-circle path as it leaves the origin. This calculator takes two pairs of latitude and longitude in decimal degrees and returns a single heading in the range 0 to 360 degrees, measured clockwise from true north. It uses the standard spherical formula that navigation libraries rely on, so the result is deterministic, free of network lookups, and suitable for route planning, map annotations, survey notes, and automated pipelines that must agree on the same number every time.
What initial bearing means (and what it is not)
Initial bearing, also called forward azimuth, is the angle at which you would set a compass if you started walking or flying along the shortest path on a sphere from point A toward point B. Zero degrees means due north, ninety means due east, one hundred eighty means due south, and two hundred seventy means due west.
Because Earth is curved, that heading is only correct at the start of the journey: as you travel along the great circle, the local compass direction required to stay on the geodesic usually changes. Final bearing (the reverse azimuth at the destination) is a different number; distance is yet another computation. This tool deliberately answers only the forward question so the contract stays simple: four coordinates in, one heading out.
Values are always normalized into the half-open interval from zero inclusive to three hundred sixty exclusive, which matches how most GIS systems and APIs express azimuth.
How to supply coordinates and read the result
Pass lat1 and lng1 for the origin and lat2 and lng2 for the destination, each as a finite number in decimal degrees. Latitudes must lie between minus ninety and ninety; longitudes between minus one hundred eighty and one hundred eighty. Positive latitude is north of the equator; positive longitude is east of the prime meridian.
Use the numeric bearing when you need precision for maps, bearing lines, or device orientation; use the cardinal only for display.
Where the formula is used in real systems
Logistics software draws arrows between warehouses and stops; drone ground stations show the heading toward the next waypoint; survey apps annotate the direction from a control point to a target; game maps orient markers toward quest destinations. All of those flows need a repeatable azimuth without calling an external geocoder.
The algorithm here is the classic spherical trigonometry identity: convert degrees to radians, form the east and north components with sine and cosine of the latitude and longitude deltas, then take atan2 of those components and wrap the result into zero through three hundred sixty. It assumes a spherical Earth, which is the same approximation used by countless open-source great-circle helpers and is accurate enough for most planning tasks under a few thousand kilometres.
For legal cadastral work or centimetre-grade surveying you would use an ellipsoidal geodesic library instead; for everyday routing, map UI, and educational tools this closed form is the right trade-off.
What you can do with it
Route and waypoint orientation
Compute the departure heading between consecutive GPS fixes so a map UI or navigation strip can draw a direction arrow that matches the planned geodesic.
Logistics and field dispatch
Give drivers or field teams a true-north bearing from the depot to a delivery or job site without requiring a full turn-by-turn engine.
Survey notes and map annotations
Record the forward azimuth from a control point to a landmark in a form or spreadsheet pipeline that must stay deterministic across devices.
FAQ
What is initial bearing?
It is the forward compass heading, in degrees clockwise from true north, of the great-circle path as it leaves the first coordinate toward the second.
Is the result magnetic north or true north?
True north. The calculator does not apply magnetic declination; apply a local variation table yourself if you need a magnetic compass reading.
Does the bearing stay constant along the whole path?
Usually not. Initial bearing is only the starting azimuth. On a sphere the local heading along a great circle generally changes; use final bearing at the destination if you need the arrival heading.
What coordinate format is accepted?
Decimal degrees only: lat1, lng1, lat2, lng2 as finite numbers. Degrees-minutes-seconds and plus-codes are not parsed; convert them first.
What bearing do I get if both points are the same?
Zero. With identical points there is no direction of travel, so the calculation settles on 0° as a stable convention instead of an undefined heading. Check your inputs if you see it unexpectedly.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/geo/bearing \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"lat1":51.5074,"lng1":-0.1278,"lat2":48.8566,"lng2":2.3522}'const res = await fetch("https://api.kit.forhosting.com/geo/bearing", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"lat1": 51.5074,
"lng1": -0.1278,
"lat2": 48.8566,
"lng2": 2.3522
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geo/bearing",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"lat1": 51.5074,
"lng1": -0.1278,
"lat2": 48.8566,
"lng2": 2.3522
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geo/bearing", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"lat1":51.5074,"lng1":-0.1278,"lat2":48.8566,"lng2":2.3522}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"lat1":51.5074,"lng1":-0.1278,"lat2":48.8566,"lng2":2.3522}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geo/bearing", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"lat1": 51.5074,
"lng1": -0.1278,
"lat2": 48.8566,
"lng2": 2.3522
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geo.bearing",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What initial bearing means (and what it is not)
If both points are the same location, the mathematical atan2 singularity resolves to zero, which is a stable convention for identical endpoints rather than an undefined heading.
How to supply coordinates and read the result
The response includes bearing rounded to six decimal places for stable automation, a unit field set to deg, the echo of from and to points so you can audit the request, and a sixteen-point cardinal label such as N, NE, or WSW for human-readable summaries. Because the arithmetic is pure and side-effect free, the free browser path and the paid API path produce the same JSON for the same input. Invalid or missing parameters fail with invalid_input and are not billed, so you can validate forms cheaply before committing a batch of waypoints.
Where the formula is used in real systems
API calls are priced at $0.002 per item on prepaid balance, with the same contract available for offline or browser execution where no account is required.
Technical questions
How much does the API cost?
Each successful request is billed at the published base price of $0.002 from prepaid KIT balance. Invalid input is not charged. The browser tool can run the same pure math locally without an account.