Lat Long Distance Calculator

Lat Long Distance Calculator

#5 · Adventure and Travel AI Skill PRO

Enter Calculation

Formula

d=2R·atan2(a,1−a)where{a=sin2Δφ2+cos⁡φ1cos⁡φ2sin2Δλ2Δφ=Lat2−Lat1Δλ=Lon2−Lon1φ1=Lat1,φ2=Lat2R=6371km\begin{gathered} d = 2R \cdot \operatorname{atan2}\!\left(\sqrt{a},\ \sqrt{1-a}\right) \\[1.5em] \text{where}\quad \left\{ \begin{aligned} a &= \sin^{2}\!\frac{\Delta\varphi}{2} + \cos\varphi_1 \cos\varphi_2 \sin^{2}\!\frac{\Delta\lambda}{2} \\ \Delta\varphi &= {{\text{Lat}_2}} - {{\text{Lat}_1}} \\ \Delta\lambda &= {{\text{Lon}_2}} - {{\text{Lon}_1}} \\ \varphi_1 &= {{\text{Lat}_1}},\quad \varphi_2 = {{\text{Lat}_2}} \\ R &= 6371\ \text{km} \end{aligned} \right. \end{gathered}
Usage stats

Advertisement

Results

Distance (km)
5,570.22 km
Distance (miles) 3,461.17 miles

Report an error on this page

What the Lat/Long Distance Calculator Does

This tool measures the great-circle distance between two points on Earth — the shortest path along the surface of a sphere, as the crow flies. You enter the geographic coordinates of two locations, and it returns the distance in both kilometres and miles. It is ideal for mapping, GIS work, route planning, logistics estimates, and any task where you have decimal latitude and longitude values and need to know how far apart they are.

Great-circle arc between two points on a globe
The great-circle distance is the shortest path between two points along Earth's surface.

The Inputs You Provide

  • Latitude 1 and Longitude 1 — the coordinates of your first point, in decimal degrees (e.g. 51.5074, -0.1278 for London).
  • Latitude 2 and Longitude 2 — the coordinates of your second point, in the same decimal-degree format.

Use negative values for the southern and western hemispheres. All four fields must be numeric; the calculator parses them as doubles before computing.

The Formula Explained

The calculator uses the Haversine formula with a fixed Earth radius of \(R = 6371\) km:

$$d = 2R \cdot \arcsin\!\left( \sqrt{ \sin^{2}\!\frac{\varphi_2-\varphi_1}{2} + \cos\varphi_1 \cdot \cos\varphi_2 \cdot \sin^{2}\!\frac{\lambda_2-\lambda_1}{2} } \right)$$

Here \(\varphi\) is latitude and \(\lambda\) is longitude, both converted to radians. The result is multiplied by 0.621371 to also report the distance in miles. Because it models Earth as a perfect sphere, expect accuracy within roughly 0.3% of the true ellipsoidal distance — more than enough for most practical needs.

Advertisement
Latitude and longitude differences between two points on a sphere
The formula uses latitude (\(\varphi\)) and the differences in latitude (\(\Delta\varphi\)) and longitude (\(\Delta\lambda\)).

Worked Example

Suppose Point 1 is London (Latitude 51.5074, Longitude −0.1278) and Point 2 is Paris (Latitude 48.8566, Longitude 2.3522). Plugging these in, the Haversine formula returns approximately 343.5 km, which equals about 213.4 miles. That is the straight-line surface distance, not the driving distance.

Step-by-Step: Computing Great-circle Distance by Hand

The calculator uses the haversine formula on a spherical Earth of radius \(R = 6371\ \text{km}\). Below is the full computation for London (51.5074° N, 0.1278° W) and Paris (48.8566° N, 2.3522° E). Latitudes north and longitudes east are positive; south and west are negative — hence London's longitude enters as \(-0.1278\).

  1. Convert all four decimal degrees to radians by multiplying by \(\pi/180 \approx 0.0174532925\):
    \(\varphi_1 = 51.5074 \times 0.0174532925 = 0.898974\ \text{rad}\)
    \(\lambda_1 = -0.1278 \times 0.0174532925 = -0.002231\ \text{rad}\)
    \(\varphi_2 = 48.8566 \times 0.0174532925 = 0.852710\ \text{rad}\)
    \(\lambda_2 = 2.3522 \times 0.0174532925 = 0.041053\ \text{rad}\)
  2. Take the differences (still in radians):
    \(\Delta\varphi = \varphi_2 - \varphi_1 = 0.852710 - 0.898974 = -0.046264\)
    \(\Delta\lambda = \lambda_2 - \lambda_1 = 0.041053 - (-0.002231) = 0.043284\)
  3. Compute the haversine term \(a\): $$a = \sin^{2}\left(\frac{\Delta\varphi}{2}\right) + \cos\varphi_1 \cos\varphi_2 \sin^{2}\left(\frac{\Delta\lambda}{2}\right)$$ Substituting: \(\sin(-0.023132) = -0.0231299\), so the first term is \(0.000534993\). Then \(\cos(0.898974) = 0.622434\), \(\cos(0.852710) = 0.657926\), and \(\sin(0.021642) = 0.0216403\), so the second term is \(0.622434 \times 0.657926 \times 0.000468303 = 0.000191739\).
    \(a = 0.000534993 + 0.000191739 = 0.000726732\)
  4. Compute the central angle \(c\): $$c = 2\arcsin\left(\sqrt{a}\right) = 2 \times \arcsin(0.026958) = 2 \times 0.026961 = 0.053923\ \text{rad}$$ The calculator's formula writes this equivalently as \(2\operatorname{atan2}\left(\sqrt{a},\ \sqrt{1-a}\right)\); atan2 is numerically safer for near-antipodal points but gives the same value here.
  5. Multiply by the Earth radius: $$d = R \cdot c = 6371 \times 0.053923 = 343.5\ \text{km}$$ so London to Paris is 343.5 km along the great circle.
  6. Convert to other units: \(343.5 \times 0.621371 = 213.4\) miles, and \(343.5 \times 0.539957 = 185.5\) nautical miles.

Two things that break hand calculations. First, every trigonometric function here must be evaluated in radian mode — a calculator left in degree mode will return a badly wrong \(a\). Second, \(\arcsin\) (and atan2) returns an angle in radians, which is exactly what step 5 needs; do not convert it to degrees before multiplying by \(R\). If you prefer degrees, divide by \(180/\pi\) first, or use \(d = R \cdot c_{\deg} \cdot \pi/180\).

This is a straight-line-over-the-sphere distance. It ignores terrain, roads, air corridors and altitude, so real travel distance is always longer.

Advertisement

Coordinate and Distance Conversions

Coordinates are often published as degrees–minutes–seconds (DMS), but this calculator expects decimal degrees. Convert with:

$$DD = D + \frac{M}{60} + \frac{S}{3600}$$

Apply the sign after the arithmetic: latitudes south of the equator and longitudes west of Greenwich are negative. (Some datasets instead write 40.7128N / 74.0061W — same numbers, different sign convention.)

DMS to decimal degrees
DMS value Substitution Decimal degrees
40°42′46″ N 40 + 42/60 + 46/3600 = 40 + 0.700000 + 0.012778 40.7128
74°00′22″ W −(74 + 0/60 + 22/3600) = −(74 + 0 + 0.006111) −74.0061
51°30′27″ N 51 + 30/60 + 27/3600 = 51 + 0.500000 + 0.007500 51.5075

The third row is the London coordinate used above; the widely quoted 51.5074 corresponds to 51°30′26.6″, so rounding seconds to the nearest whole second shifts the result by about 0.0001° (roughly 11 m).

Distance unit conversions from kilometres
From Equals
1 kilometre 0.621371 miles
1 kilometre 0.539957 nautical miles
1 kilometre 1000 metres
1 kilometre 3280.84 feet
1 mile 1.609344 kilometres (exact, international mile)
1 nautical mile 1.852 kilometres (exact, by international definition)

The nautical mile is defined as exactly 1852 m and approximates one minute of arc of latitude, which makes it convenient for navigation: a great-circle distance in nautical miles is very nearly the central angle in arc-minutes.

Frequently Asked Questions

Does this give driving distance? No. It gives the great-circle (straight-line) distance over the Earth's surface. Actual road travel will be longer because roads rarely follow a perfect arc.

What coordinate format should I use? Decimal degrees only — for example 40.7128, not 40°42′46″N. Convert degrees-minutes-seconds to decimal first.

How accurate is it? The Haversine method on a 6371 km sphere is accurate to within a fraction of a percent for almost all point pairs, which is fine for mapping, GIS and logistics estimates.

Last updated:

Most popular in Adventure and Travel

View all Adventure and Travel calculators