Enter the radius of the sphere and the latitudes and longitudes of the two points into the calculator to determine the Haversine distance.

## 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 latitude and longitude of the first point (degrees)
- lat2, lon2 are the latitude and longitude of the second point (degrees)

To calculate the Haversine distance, first subtract the latitude of the first point from the latitude of the second point and divide by 2. Square the sine of this result. Then, multiply the cosine of the first point’s latitude by the cosine of the second point’s latitude. Subtract the longitude of the first point from the longitude of the second point and divide by 2. Square the sine of this result and multiply it by the previous result. Add these two results together and take the square root. Finally, multiply this result by 2 and by the radius of the sphere, and take the arcsine to get the Haversine 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:

- First, gather the values for the variables: r, lat1, lon1, lat2, lon2.
- Next, convert the latitude and longitude values from degrees to radians.
- Next, calculate the differences between the latitude and longitude values: dlat = lat2 – lat1 and dlon = lon2 – lon1.
- Next, calculate the square of the sine of half the differences: sin2_dlat = sin^2(dlat/2) and sin2_dlon = sin^2(dlon/2).
- Next, calculate the square of the sine of half the latitude differences: sin2_lat = sin^2(lat2-lat1/2).
- Next, calculate the Haversine distance using the formula: d = 2 * r * arcsin(sqrt(sin2_dlat + cos(lat1) * cos(lat2) * sin2_dlon))).
- Finally, calculate the Haversine Distance.
- 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)