← All tools

Distance & bearing calculator

Enter two sets of coordinates and this calculator returns the great-circle distance between them, the compass bearing from one to the other, and the elevation angle you tilt up or down to sight the far summit. Heights above sea level are optional. Add them and the Earth’s curvature is taken into account. Distances read in km, miles and nautical miles.

Pick a pair to load its coordinates, then edit any field you like.

°

Decimal degrees. South and west take a minus sign.

°
°
°

Light bends a little in the atmosphere, radio waves bend more. k = 4/3 stretches the Earth radius to fold that bending into the geometry.

Great-circle distance
65.22 km
= 40.52 mi · 35.21 nmi
Initial bearing A → B
99.5 °
E · clockwise from true north
Final bearing at B
100.2 °
E · the heading you arrive on
Elevation angle A → B
+1.14 °
apparent angle to the top of B · earth drops 334 m
Horizon from A
105.3 km
B is nearer than that, so even its foot clears A’s horizon.
Midpoint
47.3002° N, 8.9176° E
half-way along the great circle
NESW99.5° Eα = +1.14°A · 870 mB · 2502 md = 65.22 kmbearing from true northside view · vertical scale ×16

Left, the compass rose. The green needle sits on the initial bearing out of A, and the amber tick marks the final bearing at B. Right, the same path in profile. Both summits stand on the curved surface, the green line is the sight line between their tops, and the amber arc is the elevation angle measured from A’s horizontal. Horizontal distance is to scale; the corner note gives how far the vertical is stretched against it.

Distance and bearing are computed on a sphere of mean radius 6 371.0088 km, so they run a few tenths of a percent off a WGS-84 geodesic. The elevation angle assumes a smooth surface between the two points. A ridge in between, or an unusual refraction day, changes what you actually see. It also treats the two points as close enough to share one horizontal, which holds for any distance you can realistically see along.

How it works

  1. 01

    Enter both points in decimal degrees

    North and east count positive, south and west negative, so Sydney is −33.86, 151.21. Degrees, minutes and seconds convert with D + M/60 + S/3600. Four decimal places put you within about 11 m, finer than most summit markers.

  2. 02

    Haversine gives the distance

    The haversine formula measures the arc across a sphere of radius 6 371.0088 km. It keeps its precision on short paths, where the plain spherical law of cosines starts losing digits, and it costs one line of arithmetic instead of an iterative geodesic solver.

  3. 03

    The bearing is an angle from true north

    The initial bearing is the heading at A, measured clockwise from true north and also named as one of the 16 compass points. A great circle curves, so the heading at B comes out slightly different. Both are true bearings, not magnetic ones.

  4. 04

    Heights turn the geometry into a sight line

    The elevation angle is how far you tilt from A’s horizontal to put the top of B in the crosshairs: α = atan((h2 − h1)/d − d/(2·k·R)). The second term is the curvature. Over 65 km the surface has already fallen 334 m away beneath the straight line.

Formulas

Great-circle distance (haversine)
a = sin2Δφ2 + cos φ1 · cos φ2 · sin2Δλ2 , d = 2 · R · atan2(a, 1 − a)
  • d — great-circle distance, m
  • R — mean Earth radius, 6 371 008.8 m
  • φ1, φ2 — the two latitudes, rad
  • Δφ, Δλ — differences in latitude and longitude, rad
Initial bearing (forward azimuth)
θ = atan2( sin Δλ · cos φ2 , cos φ1 · sin φ2 − sin φ1 · cos φ2 · cos Δλ )
  • θ — initial bearing, normalised to 0–360°
  • final bearing = bearing from B to A, turned by 180°
Elevation angle with curvature
α = atan( h2 − h1dd2 · k · R )
  • h1, h2 — heights above sea level, m
  • k — effective-earth-radius factor (1 optical, 4/3 radio)
  • α — positive above A’s horizontal, negative below

Worked example

Uetliberg to Säntis, across the Swiss plateau
  1. A, Uetliberg: 47.3496° N, 8.4911° E, 870 m
  2. B, Säntis: 47.2493° N, 9.3432° E, 2 502 m
  3. d = 65.22 km = 40.52 mi = 35.21 nmi, initial bearing 99.5° (E), final 100.2°
  4. slope: atan(1 632 m / 65 216 m) = 1.434°
  5. curvature: atan(65 216 m / (2 · 1 · 6 371 009 m)) = 0.293°
  6. → elevation angle α = +1.14°, and the Säntis sits inside the 105 km horizon of an 870 m viewpoint

FAQ

How accurate is the haversine formula compared with WGS-84?
Within a few tenths of a percent. Haversine works on a sphere, while GPS coordinates sit on the WGS-84 ellipsoid, whose equatorial radius is 21 km larger than its polar one. On the Uetliberg to Säntis example the sphere gives 65.22 km against 65.40 km for a Vincenty geodesic, a difference of 0.28%. Use a geodesic solver for survey work. For a bearing you point an antenna or a camera along, the sphere is plenty.
What is the difference between the initial and the final bearing?
A great circle is the shortest path on a sphere, and its heading changes as you go. You leave A on the initial bearing and arrive at B on the final one. Over 65 km the two differ by 0.6°, on an intercontinental path by tens of degrees. Hold one fixed compass heading instead and you walk a rhumb line, which is longer.
Is this bearing true north or magnetic north?
True north. A magnetic compass points at magnetic north, and the difference, called declination, passes 20° in some parts of the world and drifts by a fraction of a degree each year. To steer by compass, subtract an easterly declination and add a westerly one. NOAA’s World Magnetic Model gives the current value for any position.
How do I convert coordinates from degrees, minutes and seconds?
Divide the minutes by 60 and the seconds by 3 600, then add both to the degrees: 47° 20′ 58.6″ N becomes 47 + 20/60 + 58.6/3600 = 47.3496°. Anything south of the equator or west of Greenwich takes a minus sign. Degrees with decimal minutes, such as 47° 20.976′, use the same first step.
Why does the elevation angle need the Earth’s curvature?
Because the ground falls away underneath the sight line. Over a distance d the surface drops d2/(2·k·R), which is 334 m at 65 km and 1.3 km at 130 km. Leave it out and every distant summit looks higher than it is. A negative angle does not mean the summit is hidden. It only means you are looking slightly downhill at something that may still be in plain view.

Two coordinates give you the geometry. Whether the ridge in between blocks the view is a terrain question. Waveshed draws the elevation profile and the sight line over real elevation data, free in your browser.

Check the profile on the map →

Related guides

Sources & further reading

Related tools