Skip to content
FiftyCalc Free calculators for all 50 states

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

Sample figures

Distance—mi

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.

Latitude Longitude Distance Calculator

Point 1 latitude (−90 to 90), in °: enter a number from -90 to 90. Prefilled example: 40.7128.

Point 1 longitude (−180 to 180), in °: enter a number from -180 to 180. Prefilled example: -74.006.

Point 2 latitude, in °: enter a number from -90 to 90. Prefilled example: 34.0522.

Point 2 longitude, in °: enter a number from -180 to 180. Prefilled example: -118.2437.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Point 1 latitude (−90 to 90), in °: enter a number from -90 to 90.
  2. Point 1 longitude (−180 to 180), in °: enter a number from -180 to 180.
  3. Point 2 latitude, in °: enter a number from -90 to 90.
  4. Point 2 longitude, in °: enter a number from -180 to 180.
  5. 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

  1. H=sin⁡(rad⁡(la−l)2)2+cos⁡(rad⁡(l))×cos⁡(rad⁡(la))×sin⁡(rad⁡(lon−lo)2)2
  2. Km=2×6,371×atan2⁡(H,1−H)
  3. Mi=Km1.609344
Symbols used in the formula
SymbolMeaningUnit
lPoint 1 latitude (−90 to 90)°
loPoint 1 longitude (−180 to 180)°
laPoint 2 latitude°
lonPoint 2 longitude°
HHaversine term a
KmDistancekm
MiDistancemi
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 latitude34.0522 °
Point 2 longitude-118.2437 °
Distance (km)3,935.7463
  1. H=sin⁡(rad⁡(34.0522−40.7128)2)2+cos⁡(rad⁡(40.7128))×cos⁡(rad⁡(34.0522))×sin⁡(rad⁡(−118.244−−74.006)2)2=0.0924109
  2. Km=2×6,371×atan2⁡(0.0924109,1−0.0924109)=3,935.75
  3. Mi=3,935.751.609344=2,445.56

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.

Questions answered

Related calculators