Haversine Distance Calculator

Great-circle distance between two latitude / longitude points.

Open tool

Overview

The Haversine Distance Calculator returns the great-circle distance between two latitude/longitude coordinates on Earth. Plug in any two points and the tool reports the shortest distance over the sphere in kilometres, statute miles and nautical miles. This is the distance an aircraft or ship would travel along the shortest path, not the straight-line tunnel distance through the planet.

Great-circle distance is the standard ruler for anything that moves over the Earth's surface: flight planning, delivery radius estimates, GPS fitness tracking, customer proximity queries, and back-of-envelope route comparison. It is also the building block for several other tools - bearing calculation, midpoint, waypoint generation - because each of those needs a notion of "how far apart" to anchor its math.

How it works

The haversine formula computes the great-circle distance between two points on a sphere given their latitudes and longitudes. Let φ₁, φ₂ be the latitudes and λ₁, λ₂ the longitudes, all in radians. Compute a = sin²((φ₂ - φ₁) / 2) + cos(φ₁) · cos(φ₂) · sin²((λ₂ - λ₁) / 2). The central angle is then c = 2 · atan2(√a, √(1-a)) and the distance is d = R · c where R is the radius of Earth - 6371 km for the mean radius used in most calculators.

The formula assumes Earth is a perfect sphere. For most everyday distances the error compared to the true WGS84 ellipsoidal distance (Vincenty's formulae) is well under 0.5 percent - typically only a few hundred metres on a flight of thousands of kilometres.

Examples

  • London Heathrow to New York JFK - about 5,541 km / 3,443 mi / 2,992 nm.
  • Sydney to Singapore - about 6,302 km / 3,916 mi / 3,403 nm.
  • Two points one degree of latitude apart on the same meridian - exactly 111.2 km, the convenient one-degree-equals-111-km rule.
  • Two points one degree of longitude apart at the equator - the same 111.2 km, but at latitude 60 it shrinks to about 55.6 km.

FAQ

Why not just use Pythagoras on lat/lng?
The Earth is round. Treating lat/lng as flat Cartesian coordinates is only acceptable for distances under about 100 km in mid-latitudes, and even then introduces error. Haversine is barely more code and works everywhere.

Is haversine more accurate than Vincenty?
Vincenty's ellipsoidal formula is more accurate by about 0.3 percent because it models Earth's oblateness, but it is also more complex and can fail to converge on antipodal points. Haversine is the everyday workhorse.

Which Earth radius does the tool use?
The IUGG mean radius, 6371 km. This is the standard value used by most online distance calculators.

Can I get the result in miles or nautical miles?
Yes. The tool always reports kilometres, statute miles (1 mi = 1.609344 km) and nautical miles (1 nm = 1.852 km) side by side.

Try Haversine Distance Calculator

An unhandled error has occurred. Reload ×