Calculate the haversine distance between two latitude and longitude points in km, miles and nautical miles, with bearings, midpoint and destination point.
Related Calculators
- Polar Distance Calculator
- Central Angle Calculator
- Distance From Point to Plane Calculator
- Inverse Tan Calculator
- All Math and Numbers Calculators
Calculator Functions
| Function | What it does | What it requires |
|---|---|---|
| Distance and bearings | Finds the great-circle distance between two coordinates, with the initial bearing, final bearing and midpoint | Requires the latitude and longitude of point A and point B in decimal degrees |
| Destination coordinates | Finds the latitude and longitude reached by travelling a set distance along a starting bearing | Requires the starting latitude and longitude, an initial bearing in degrees and a distance in km, mi or nmi |
North latitudes and east longitudes are positive, and south and west are negative. Bearings are measured clockwise from true north. The one optional setting is the sphere radius, which is a mean Earth radius of 6,371.0088 km when left blank. The distance is shown in kilometers, miles, nautical miles and meters, using 1 mi = 1.609344 km and 1 nmi = 1.852 km [2].
Haversine Distance Formulas
| d | Great-circle distance, in the units of R |
| R | Sphere radius, 6,371.0088 km by default |
| ฯ1, ฯ2 | Latitudes of points A and B, in radians |
| ฮฯ | ฯ2 โ ฯ1 |
| ฮฮป | Longitude of B minus longitude of A, in radians |
Degrees are converted to radians by multiplying by ฯ รท 180. The quantity 2 ร arcsin(โa) is the central angle between the two points, and multiplying it by the radius gives the distance along the surface. The same angle can be found from cos c = sin ฯ1 sin ฯ2 + cos ฯ1 cos ฯ2 cos ฮฮป, but that form loses accuracy when the points are close together, while the haversine form stays accurate from zero to nearly 180ยฐ [1].
Distance and bearings
For A at 40ยฐ, โ75ยฐ and B at 35ยฐ, โ80ยฐ: ฮฯ = โ5ยฐ and ฮฮป = โ5ยฐ, so a = sinยฒ(โ2.5ยฐ) + cos 40ยฐ ร cos 35ยฐ ร sinยฒ(โ2.5ยฐ) = 0.003097. The central angle is 2 ร arcsin(โ0.003097) = 6.380ยฐ, or 0.11135 radians, and d = 6,371.0088 ร 0.11135 = 709.42 km (440.81 mi, 383.06 nmi).
ฮธ is the initial bearing from A toward B, placed in the correct quadrant and given from 0ยฐ to 360ยฐ. In the example it is 219.98ยฐ, or southwest. A great circle changes direction as it goes, so the final bearing on arrival is different: 216.93ยฐ here. The final bearing is the bearing from B back to A, turned by 180ยฐ. The midpoint is the point halfway along the path, 37.5263ยฐ, โ77.5838ยฐ in the example. For two identical points or two points exactly opposite each other on the globe, the bearings are undefined, and the midpoint of opposite points is not unique.
Destination coordinates
cos ฯ1 ร sin c ร cos ฮธ)
ฮป2 = ฮป1 + arctan(sin c ร
sin ฮธ รท (cos ฯ1 ร cos c โ
sin ฯ1 ร sin c ร cos ฮธ)) [1]
c is the distance travelled divided by the radius, which is the angle covered in radians, and ฮธ is the initial bearing. Starting at 40ยฐ, โ75ยฐ and going 100 km due east (90ยฐ) ends at 39.9941ยฐ, โ73.8261ยฐ. The latitude drops slightly because a great circle heading east curves toward the equator. Travelling 60 nautical miles due north from 0ยฐ, 0ยฐ ends at 0.9993ยฐ, 0ยฐ, close to one degree of latitude. A nonzero trip cannot start exactly at a pole, where every direction is south or north and a bearing has no meaning.
Limits of This Estimate
- The Earth is treated as a perfect sphere. The real Earth is slightly flattened, so survey-grade distances are computed on an ellipsoid and differ slightly from a spherical result.
- The distance is the shortest path over the surface, not a driving or sailing route, and it ignores altitude.
- Entering a custom radius changes the sphere. A radius of 6,371 km gives 709.4193 km for the example above, about one meter less than the default.
Sources
- U.S. Geological Survey, Map Projections: A Working Manual (Professional Paper 1395), equations 5-3 to 5-6: great-circle distance in haversine form, the azimuth between two points, and the latitude and longitude at a given distance and azimuth
- NIST, Guide for the Use of the International System of Units (SP 811), Appendix B.8: meters in a mile and in a nautical mile
