Haversine Distance Calculator
Calculate the great-circle distance between two coordinates in km and miles using the Haversine formula.
How to use this tool
- Enter the latitude and longitude of your starting point.
- Enter the latitude and longitude of your destination.
- The calculator returns the great-circle (shortest path over the Earth's surface) distance in both km and miles.
Calculate the straight-line great-circle distance between any two points on Earth using latitude and longitude coordinates.
Formula
a = sin²(Δlat/2) + cos(lat₁) × cos(lat₂) × sin²(Δlon/2)
c = 2 × atan2(√a, √(1−a))
Distance = R × c, where R = 6371 km (Earth's mean radius)
How it works
This calculator applies the Haversine formula to compute the shortest path between two geographic coordinates along the surface of a sphere. Latitudes and longitudes are converted to radians before computing the angular difference; the result in kilometres is converted to miles using the factor 0.621371. The formula assumes a perfectly spherical Earth, so distances may differ by up to 0.5% from geodetic (ellipsoid-based) calculations for long routes.
Worked example
Worked example
- Point 1: Paris (48.8566°N, 2.3522°E), Point 2: London (51.5074°N, −0.1278°E)
- Convert coordinates to radians and compute Δlat and Δlon
- Calculate a = sin²(Δlat/2) + cos(lat₁)×cos(lat₂)×sin²(Δlon/2)
- Apply c = 2×atan2(√a, √(1−a)) and multiply by R = 6371 km
- Convert km to miles: 343.56 × 0.621371 ≈ 213.48 mi
Distance = 343.56 km (213.48 miles)
Key terms
- Haversine formula
- A trigonometric formula that calculates the great-circle distance between two points on a sphere given their latitudes and longitudes.
- Great-circle distance
- The shortest distance between two points on the surface of a sphere, measured along the surface itself.
- Latitude
- The angular distance of a point north or south of the equator, measured in degrees from −90° to +90°.
- Longitude
- The angular distance of a point east or west of the prime meridian, measured in degrees from −180° to +180°.
- Earth's mean radius
- Approximately 6371 km, used in the Haversine formula as the radius of the assumed spherical Earth.
Frequently asked questions
- What is the Haversine formula?
- The Haversine formula calculates the shortest distance over the Earth's surface between two points given their latitudes and longitudes. It accounts for the spherical shape of the Earth.
- How accurate is the Haversine calculator?
- The Haversine formula assumes a perfectly spherical Earth. Real-world accuracy is within about 0.3% of the true distance for most navigation purposes.