Bearing and Distance Calculator

This bearing and distance calculator finds the shortest route between any two points on the Earth and the compass heading you set off on. Enter the latitude and longitude of a start point and an end point in decimal degrees, with north and east positive and south and west negative, and it returns the great-circle distance in kilometers together with the initial bearing in degrees from true north. The distance uses the haversine formula, the standard spherical method that the US National Oceanic and Atmospheric Administration and navigators worldwide rely on for planning, with a mean Earth radius of 6,371 kilometers. The initial bearing is the forward azimuth measured clockwise from north, so a result near 270 degrees means you begin heading roughly west. Because a great circle is the genuine shortest path across a sphere, it differs from a constant-heading rhumb line, and the bearing shifts gradually as you travel. Use the tool to compare flight routes, plan a sailing leg, or sense-check a heading. Every figure here is computed deterministically from the haversine and forward-azimuth formulas shown in full below, with a worked example that reconciles exactly to the calculator so you can follow each step yourself.

The haversine formula gives the great-circle distance and the forward azimuth gives the heading: from (40, -74) to (34, -118) the distance is 3,923.61 km on an initial bearing of 274.47 degrees. Latitudes are north-positive and longitudes east-positive.

Source: US National Oceanic and Atmospheric Administration (NOAA). As at 25 June 2026.

North positive, south negative
East positive, west negative
Great-circle distance--
Initial bearing--
Compass direction--

Bearing and distance formula

a = sin^2(d_lat / 2) + cos(lat1) cos(lat2) sin^2(d_lon / 2)
distance = R x 2 x atan2( sqrt(a), sqrt(1 - a) )
bearing = atan2( sin(d_lon) cos(lat2), cos(lat1) sin(lat2) - sin(lat1) cos(lat2) cos(d_lon) )
R = 6,371 km (mean Earth radius), all angles in radians
d_lat = lat2 - lat1, d_lon = lon2 - lon1

The haversine term a captures the chord between the two points; doubling its inverse haversine and scaling by the Earth radius gives the surface distance. The bearing is the angle of the initial heading, converted to a 0 to 360 degree compass value.

Worked example

Travel from latitude 40, longitude -74 to latitude 34, longitude -118, using a mean Earth radius of 6,371 km.

  1. d_lat = 34 - 40 = -6 deg = -0.104720 rad; d_lon = -118 - (-74) = -44 deg = -0.767945 rad
  2. a = sin^2(-0.052360) + cos(0.698132) cos(0.593412) sin^2(-0.383972) = 0.091857
  3. distance = 6,371 x 2 x atan2(sqrt(0.091857), sqrt(0.908143)) = 6,371 x 0.615848 = 3,923.61 km
  4. bearing = atan2(-0.575898, 0.045000) = -85.53 deg, plus 360 = 274.47 deg
  5. 274.47 deg lies between west and north, so the initial heading is roughly west

The distance is 3,923.61 km on an initial bearing of 274.47 degrees. These are the calculator's default inputs, so the result above matches the widget exactly.

Compass directions by bearing

The initial bearing maps to an eight-point compass rose as follows.

Bearing range (deg)Direction
337.5 to 22.5North
22.5 to 67.5Northeast
67.5 to 112.5East
112.5 to 157.5Southeast
157.5 to 202.5South
202.5 to 247.5Southwest
247.5 to 292.5West
292.5 to 337.5Northwest

Method and navigation reference: US National Oceanic and Atmospheric Administration (NOAA).

Bearing and distance calculator: frequently asked questions

What is the great-circle distance?

The great-circle distance is the shortest path between two points on the surface of a sphere, measured along the surface rather than straight through the body. For points on the Earth, it is the route a ship or aircraft would follow to cover the least ground. This calculator uses the haversine formula with a mean Earth radius of 6,371 kilometers, which is accurate to within a fraction of a percent for most journeys.

What is the initial bearing?

The initial bearing, also called the forward azimuth, is the compass direction you would set off in from the first point to travel the great-circle route to the second. It is measured clockwise from true north, so 0 degrees is north, 90 is east, 180 is south and 270 is west. On a great-circle path the bearing changes continuously along the way, so the final bearing differs from the initial bearing.

Why does the bearing change along the route?

A great circle crosses each meridian at a different angle, so a constant-heading rhumb line and the shortest great-circle path are not the same. The calculator reports the initial bearing at the departure point. Navigators recompute the bearing periodically, or follow a rhumb line that holds a single heading at the cost of a slightly longer distance.

How accurate is the haversine formula?

The haversine formula treats the Earth as a perfect sphere. Because the Earth is a slightly flattened ellipsoid, distances can differ from the true geodesic value by up to about 0.5 percent. For navigation planning, route comparison and general reference this is usually close enough. For survey-grade work, use an ellipsoidal method such as Vincenty's formulae.

What sign convention do latitude and longitude use?

Latitude is positive north of the equator and negative south of it. Longitude is positive east of the prime meridian and negative west of it. So New York is near latitude 40 and longitude -74, while Los Angeles is near latitude 34 and longitude -118. Enter degrees as decimals; the calculator converts them to radians internally.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 25 June 2026. See our methodology. This is general information, not financial, tax, legal or investment advice.