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.
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.
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\).
- 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}\) - 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\) - 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\) - 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.
- 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.
- 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.
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 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).
| 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.