Calculate great-circle distance between latitude and longitude points, including kilometers, miles, nautical miles, bearings, midpoint, and destination coordinates.

Find the shortest spherical distance, bearings and midpoint between two coordinates.

Decimal degrees. North is positive; south is negative.

East is positive; west is negative.

Optional settings

Blank uses a mean Earth radius of 6371.0088 km. A custom radius changes the spherical model.


Related Calculators

Haversine Distance Formula

The following formula is used to calculate the Haversine Distance between two points on the surface of a sphere (often Earth).

d = 2 * r * arcsin(sqrt(sin^2((lat2-lat1)/2) + cos(lat1) * cos(lat2) * sin^2((lon2-lon1)/2)))

Variables:

  • d is the Haversine distance between the two points (km or miles)
  • r is the radius of the sphere (usually Earth’s radius, approx. 6371km or 3959 miles)
  • lat1, lon1 are the first pointโ€™s latitude and longitude, converted from entered degrees to radians for the formula
  • lat2, lon2 are the second pointโ€™s latitude and longitude, converted from entered degrees to radians for the formula

Convert coordinates to radians. Calculate a = sinยฒ((lat2 โˆ’ lat1)/2) + cos(lat1) ร— cos(lat2) ร— sinยฒ((lon2 โˆ’ lon1)/2). Clamp small floating-point excursions of a to the interval 0โ€“1. Take the arcsine of โˆša first, then multiply that angle by 2r. The calculator uses an equivalent stable vector calculation for the central angle. Earth is modeled as a sphere, so this is an approximation to an ellipsoidal surface distance.

What is a Haversine Distance?

Haversine Distance is a method of calculating the shortest distance between two points on the surface of a sphere, given their longitudes and latitudes. It is especially important in navigation and geography where accurate distance measurements between points on the Earth’s surface are required. The formula is derived from the haversine formula in trigonometry and takes into account the Earth’s curvature to give more accurate results than methods assuming a flat Earth.

How to Calculate Haversine Distance?

The following steps outline how to calculate the Haversine Distance:


  1. First, gather the values for the variables: r, lat1, lon1, lat2, lon2.
  2. Next, convert the latitude and longitude values from degrees to radians.
  3. Next, calculate the differences between the latitude and longitude values: dlat = lat2 – lat1 and dlon = lon2 – lon1.
  4. Next, calculate the square of the sine of half the differences: sin2_dlat = sin^2(dlat/2) and sin2_dlon = sin^2(dlon/2).
  5. Next, form a = sin2_dlat + cos(lat1) ร— cos(lat2) ร— sin2_dlon, using radian coordinates.
  6. Next, calculate the Haversine distance using d = 2 ร— r ร— arcsin(โˆša). The arcsine operates on โˆša before multiplying by 2r.
  7. Finally, calculate the Haversine Distance.
  8. After inserting the variables and calculating the result, check your answer with the calculator above.

Example Problem : 

Use the following variables as an example problem to test your knowledge.

r = 6371 (Earth’s radius in km)

lat1 = 40 (latitude of the first point in degrees)

lon1 = -75 (longitude of the first point in degrees)

lat2 = 35 (latitude of the second point in degrees)

lon2 = -80 (longitude of the second point in degrees)