MTL logo

Movable Type Scripts


Calculate distance, bearing and more between Latitude/Longitude points

This page presents a variety of calculations for lati­tude/longi­tude points, with the formulas and code fragments for implementing them.

All these formulas are for calculations on the basis of a spherical earth (ignoring ellipsoidal effects) – which is accurate enough* for most purposes… [In fact, the earth is very slightly ellipsoidal; using a spherical model gives errors typically up to 0.3%1 – see notes for further details].

Great-circle distance between two points

Enter the co-ordinates into the text boxes to try out the calculations. A variety of formats are accepted, principally:

  • deg-min-sec suffixed with N/S/E/W (e.g. 40°44′55″N, 73 59 11W), or
  • signed decimal degrees without compass direction, where negative indicates west/south (e.g. 40.7486, -73.9864):
Point 1: ,
Point 2: ,
Distance: km (to 4 SF*)
Initial bearing:
Final bearing:
Midpoint:

And you can see it on a map

... hide map