MathsFree

Distance Between Coordinates Calculator

Calculate the straight-line (great-circle) distance between two points on Earth using latitude and longitude coordinates. This calculator uses the haversine formula with a mean Earth radius of 6,371 km to compute the shortest path over the surface of the sphere. Results are shown in both kilometers and miles. Used in navigation, aviation, logistics, GIS mapping, and geocaching.

Enter Values

Result

Enter values above and click Calculate to see your result.

AI Assistant

Ask about this calculator

I can help you understand the distance between coordinates calculator formula, interpret your results, and answer follow-up questions.

Try asking

Formula

#
Core Formula
a=sin2 ⁣(Δϕ2)+cosϕ1cosϕ2sin2 ⁣(Δλ2)  d=R×2atan2 ⁣(a,1a)a = \sin^2\!\left(\frac{\Delta\phi}{2}\right) + \cos\phi_1 \cdot \cos\phi_2 \cdot \sin^2\!\left(\frac{\Delta\lambda}{2}\right) \\[6pt] \; d = R \times 2 \cdot \text{atan2}\!\left(\sqrt{a},\, \sqrt{1-a}\right)

How it works: The haversine formula computes the central angle between two points on a sphere from their latitude and longitude (converted to radians), then multiplies by the Earth radius (6,371 km) to get the surface distance. This accounts for the curvature of the Earth, unlike flat-plane distance formulas which only work for very short distances.

Worked Example

Distance from Paris (48.8566, 2.3522) to London (51.5074, -0.1278):
1Step 1: Convert coordinates to radians
2Step 2: dlat = 0.04626 rad, dlon = -0.04317 rad
3Step 3: a = sin^2(0.02313) + cos(0.8527) x cos(0.8989) x sin^2(-0.02159) = 0.000895
4Step 4: c = 2 x atan2(0.02992, 0.99955) = 0.05984 rad
5Step 5: d = 6371 x 0.05984 = 343.6 km (213.5 miles)

How the Haversine Formula Calculates Earth Distance

The haversine formula is the standard method for calculating the shortest distance between two points on the surface of a sphere given their latitude and longitude coordinates.

  • Converts latitude and longitude from degrees to radians, then computes the central angle between the two points
  • Uses Earth mean radius of 6,371 km (3,959 miles) to convert the angular distance to a surface distance
  • Accurate to within 0.3% for most practical distances, sufficient for navigation, logistics, and GIS applications
  • Works for any two points on Earth, including across hemispheres, the date line, and near the poles
  • For very long distances requiring higher precision, the Vincenty formula (which models Earth as an oblate spheroid) reduces error to under 0.5 mm

Enter any two GPS coordinates in decimal degrees above to compute the haversine distance instantly. Results are shown in both kilometers and miles.

You can also calculate changes using our Midpoint and Distance Calculator or Golden Ratio Calculator.

Frequently Asked Questions

Why is haversine distance different from driving distance?

The haversine formula calculates the shortest path over the surface of a perfect sphere (as the crow flies). Driving distance follows roads, highways, and terrain, which is always longer. Use this for straight-line distance; use a mapping service for driving directions.

What Earth radius does this calculator use?

It uses 6,371 km, the widely accepted mean Earth radius. Since Earth is slightly flattened at the poles (oblate spheroid), this value introduces a small error of up to 0.3% for very long distances. For most practical purposes, this is more than accurate enough.

Can I enter coordinates in degrees, minutes, seconds?

This calculator accepts decimal degrees only. To convert DMS to decimal: degrees + (minutes / 60) + (seconds / 3600). For example, 48 degrees 51 minutes 23 seconds = 48.8564 decimal degrees.

Does this work for any two points on Earth?

Yes. The haversine formula works for any pair of latitude/longitude coordinates, including across hemispheres, the international date line, and near the poles. Latitude must be between -90 and 90, longitude between -180 and 180.

How accurate is the haversine formula?

For most distances, haversine is accurate to within 0.3% (about 1 km error per 300 km). For higher accuracy on very long distances, the Vincenty formula accounts for Earth being an oblate spheroid, but haversine is sufficient for the vast majority of applications.

What is the haversine formula and how does it work?

The haversine formula calculates the shortest distance between two points on a sphere given their latitude and longitude. It works in three steps:

(1) compute the central angle using a = sin^2(dlat/2) + cos(lat1) x cos(lat2) x sin^2(dlon/2).

(2) find the angular distance c = 2 x atan2(sqrt(a), sqrt(1-a)).

(3) multiply by Earth radius d = 6,371 x c to get distance in km. The name "haversine" comes from "half versed sine", a trigonometric function. It is preferred over simpler formulas because it remains numerically stable for small distances.

How do I add this Distance Between Coordinates Calculator to my site?

Absolutely. Use the "Embed" option above to tailor the dimensions, color scheme, and styling to match your site. Copy the generated iframe snippet and drop it into your HTML, WordPress editor, or any CMS. There is no cost and no account required. See calculory.com/services/embed-calculators for a step-by-step walkthrough.

Accurate and Reliable

All calculations run locally. Step-by-step solutions you can trust.

Verified Precision

Precise Mathematical Calculations Powered by Calculory AI