Haversine Distance Calculator
Calculate distance between coordinates using the haversine formula.
About Haversine Distance Calculator
The haversine formula is numerically stable for short distances, where the simpler spherical law of cosines loses precision through catastrophic cancellation. That stability is why it is the standard choice. Using the law of cosines for nearby points can produce errors of tens of metres or fail entirely, which matters for anything geofenced.
Formula
Haversine Distance
a = sin²(Δlat/2) + cos(lat₁)cos(lat₂)sin²(Δlon/2); distance = 2R·atan2(√a, √(1−a))
- haversine
- Half the versed sine, a formulation stable for small distances
- Δlat, Δlon
- Differences in latitude and longitude in radians
Worked example
With the default values below, Haversine Distance Calculator returns Distance of 5,570.222. Change any input above and every figure here is recalculated in your browser.
Inputs used
- First latitudeaccepts -90–90 degrees
- 51.5074 degrees
- First longitudeaccepts -180–180 degrees
- -0.1278 degrees
- Second latitudeaccepts -90–90 degrees
- 40.7128 degrees
- Second longitudeaccepts -180–180 degrees
- -74.006 degrees
Results
- Distance
- 5,570.222 km
- Distance
- 3,461.175 miles
- Distance
- 3,007.681 nmi
- Initial Bearing
- 288.33 degrees
- Flight Time at 900 km/h
- 6.189 h
Step by step
- 1Values used
- 2Haversine Distance
- 3Distance= 5,570.222 km
- 4Distance= 3,461.175 miles
- 5Distance= 3,007.681 nmi
- 6Initial Bearing= 288.33 degrees
- 7Flight Time at 900 km/h= 6.189 h
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 3 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is Haversine Distance calculated?
a = sin²(Δlat/2) + cos(lat₁)cos(lat₂)sin²(Δlon/2); distance = 2R·atan2(√a, √(1−a)) The haversine formula is numerically stable for short distances, where the simpler spherical law of cosines loses precision through catastrophic cancellation. That stability is why it is the standard choice.
Why does Haversine Distance matter?
Using the law of cosines for nearby points can produce errors of tens of metres or fail entirely, which matters for anything geofenced.
What values do I need to enter?
This calculator takes 4 inputs: First latitude, First longitude, Second latitude, Second longitude. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Related Calculators
- Accommodation Cost Calculator
- Air Pressure Altitude Calculator
- Airport Transfer Time Calculator
- Altitude Adjustment Calculator
- ATM Fee Impact Calculator
- Baggage Fee Calculator
- Bearing Between Coordinates Calculator
- Car Travel Carbon Footprint Calculator
- Coordinate Converter Calculator
- Currency Exchange Spread Calculator
You might also need
- Accommodation Cost CalculatorCommonly used together
- Air Pressure Altitude CalculatorCommonly used together
- Airport Transfer Time CalculatorCommonly used together
- Altitude Adjustment CalculatorCommonly used together
- ATM Fee Impact CalculatorCommonly used together
- Baggage Fee CalculatorCommonly used together
