Haversine Distance Calculator
From two pairs of coordinates, get the great-circle distance over the curved surface of the Earth — the shortest path as the crow flies, in kilometres and miles.
Straight-line, not driving
This is the as-the-crow-flies distance over the Earth's surface, not a road or driving distance — a real journey is always longer.
What is a haversine distance calculator?
Coordinates in, great-circle distance out
A haversine distance calculator turns two pairs of geographic coordinates — each a latitude and a longitude in degrees — into the great-circle distance between them: the shortest path that follows the curved surface of the Earth. The haversine formula treats the planet as a sphere of radius 6371 km (the mean Earth radius), which is accurate to a few tenths of a percent for everyday distances. It is the standard way GPS apps, flight planners, and mapping tools measure how far apart two places really are.
Enter a start and an end latitude and longitude to get the great-circle distance in kilometres and miles instantly.
The haversine formula uses the differences in latitude and longitude, with the latitudes converted to radians, and the mean Earth radius R = 6371 km.
h = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2), distance = 2 × R × asin(√h)Here φ₁ and φ₂ are the two latitudes in radians, Δφ is the difference in latitude, and Δλ is the difference in longitude. The intermediate value h is the square of half the chord length between the points; taking 2 × R × asin(√h) turns that chord back into the arc that follows the Earth's surface. Because longitude is negative in the west and latitude is negative in the south, the formula works across the equator and the prime meridian without any special cases.
Take Berlin at latitude 52.52, longitude 13.405 and Munich at latitude 48.1351, longitude 11.582.
Differences
Δφ = 48.1351 − 52.52 = −4.3849°, Δλ = 11.582 − 13.405 = −1.823° — convert these and the two latitudes to radians.
Haversine term
h = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2) — combine the latitude and longitude gaps.
Distance
2 × 6371 × asin(√h) = 504.415 km ≈ 313.429 miles — the straight-line distance from Berlin to Munich.
The number you get is the great-circle distance — the shortest possible path between the two points if you could travel straight over the curved surface of the Earth. For Berlin to Munich that is about 504.415 km (313.429 miles). The single most important thing to keep in mind is that this is the as-the-crow-flies distance, not how far you would actually drive or walk: roads bend around mountains, lakes, and borders, so a real Berlin–Munich drive is closer to 585 km. Treat the haversine result as a floor — the true travel distance is always equal to or longer than it. The distance in miles is simply the kilometre figure multiplied by 0.621371, so both describe exactly the same path. Because the formula assumes a perfect sphere, the answer is accurate to within roughly 0.3 % for any pair of points; that is more than precise enough for trip planning, sorting nearby places, or estimating a flight's length.
The haversine formula is exact for a sphere, but a couple of practical points are worth keeping in mind.
Spherical model and straight-line only
The haversine formula models the Earth as a perfect sphere of radius 6371 km. The real planet is slightly flattened at the poles, so the result can differ from the true geodesic distance by up to about 0.3 % — fine for everyday use, but for survey-grade accuracy use an ellipsoidal method such as Vincenty's formula. The result is also a straight great-circle distance over the surface, never a road, rail, or flight-path distance, and it ignores altitude. Enter latitudes between −90 and 90 and longitudes between −180 and 180, in decimal degrees, for a meaningful answer.