Latitude Longitude Distance Calculator
Test cases replayed : 2 of 2 match · Methodology · No outside source listed
Enter two points in decimal degrees (south and west are negative) to get the straight-line distance over the Earth's surface.
Result
Distancemi
Haversine term a
- Distance (km)
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Point 1 latitude (−90 to 90), in °: enter a number from -90 to 90.
- Point 1 longitude (−180 to 180), in °: enter a number from -180 to 180.
- Point 2 latitude, in °: enter a number from -90 to 90.
- Point 2 longitude, in °: enter a number from -180 to 180.
- Read the result: Distance; the panel also shows Haversine term a and Distance (km).
How this calculator works
Haversine formula: a = sin²(Δφ ÷ 2) + cos φ₁ × cos φ₂ × sin²(Δλ ÷ 2), d = 2R × atan2(√a, √(1 − a)), with φ the latitudes and λ the longitudes in radians.
R = 6,371.0 km, the Earth's volumetric mean radius in NASA's Earth Fact Sheet (https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html, read 2026-10-27). Treating the Earth as a sphere puts the result within about 0.5% of the true distance on the ellipsoid (equatorial radius 6,378.137 km, polar 6,356.752 km, same source).
Kilometers are turned into miles at 1.609344 km per mile, an exact factor (NIST SP 811 Appendix B, read 2026-10-27).
The formula
| Symbol | Meaning | Unit |
|---|---|---|
| Point 1 latitude (−90 to 90) | ° | |
| Point 1 longitude (−180 to 180) | ° | |
| Point 2 latitude | ° | |
| Point 2 longitude | ° | |
| Haversine term a | ||
| Distance | km | |
| Distance | mi | |
rad(x) | the angle x, converted from degrees to radians. | |
atan2(y, x) | the angle, in radians, of the point (x, y) measured from the positive x-axis. |
Worked example
| Point 1 latitude (−90 to 90) | 40.7128 ° |
|---|---|
| Point 1 longitude (−180 to 180) | -74.006 ° |
| Point 2 latitude | 34.0522 ° |
| Point 2 longitude | -118.2437 ° |
| Distance (km) | 3,935.7463 |
|---|
Distance 2,445.5593 mi
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
How far is New York from Los Angeles in a straight line?
About 2,445 miles (3,936 km) from (40.7128, −74.006) to (34.0522, −118.2437).
Is this the driving distance?
No. It is the shortest path over the Earth's surface; roads are longer.