Home · Math · Plane Geometry · Latitude Longitude Distance Calculator

Latitude Longitude Distance Calculator

Surface distance between two latitude/longitude points by the haversine formula on a sphere of radius 6,371 km.

Your figures

Example result — edit the figures to make it yours

225,501.6

Distance

Distance140,120.2 mi

What this calculator does

Surface distance between two latitude/longitude points by the haversine formula on a sphere of radius 6,371 km. Every figure on this page is computed from the formula or definition stated below, with no hidden rounding steps, and the method notes name the exact convention where more than one exists.

The formula and method

a = sin^2(dlat/2) + cos(lat1) cos(lat2) sin^2(dlon/2); d = 2R atan2(sqrt(a), sqrt(1 - a))

The haversine formula is numerically stable even for small distances: it forms a from the latitude and longitude differences, then the central angle as 2 atan2(sqrt(a), sqrt(1-a)), times Earth's mean radius 6,371 km. Enter latitudes and longitudes in degrees, south and west negative. All angles are in degrees; trigonometric outputs use the degree-based functions so no radian conversion is needed.

A spherical Earth is assumed; ellipsoidal (geodesic) distances differ by up to about 0.3%. This is the shortest surface path, not a road or flight-route distance.

Worked example

With the example inputs this page opens with (latitude 1 (deg) 40.7128, longitude 1 (deg) -74.006, latitude 2 (deg) 34.0522, longitude 2 (deg) -118.2437), the result is 225,501.6 — distance. Change any figure and the result updates with the same formula.

Quick reference

Quick reference — varying latitude 1 (deg)
Latitude 1 (deg)Distance
20.3564263,096.5
32.5702233,871.5
40.7128225,501.6
50.891229,408.9
61.0692248,423.2
81.4256318,834.0

Computed with the same formulas as the calculator above — enter any values there for figures beyond this table.

Common questions

How does the Latitude Longitude Distance Calculator work?

Surface distance between two latitude/longitude points by the haversine formula on a sphere of radius 6,371 km. Lat/lon point 1 - Lat/lon point 2 -> Distance (km). The result updates as you type, and the formula and method on this page state the exact definitions used, so you can reproduce the calculation by hand.

What inputs does the Latitude Longitude Distance Calculator need?

Lat/lon point 1 - Lat/lon point 2 -> Distance (km). Invalid entries — such as a zero denominator, an out-of-range value or a malformed list — produce a plain-language message instead of a misleading number.

Is the Latitude Longitude Distance Calculator free to use?

Yes. It runs entirely in your browser with no sign-up, and the same calculator is available as an embeddable widget via the Embed button, so it can be placed on another site with its calculation intact.