Toolvito

Works on this device

Earth Distance & Area Calculator

Work out the distance over the Earth between two points from their latitude and longitude, the length of a route of several points, and the area inside an outline of points. Choose a sphere (the haversine formula) or the WGS 84 ellipsoid that GPS uses.

Enter your values

The shortest distance over the Earth between two points given by latitude and longitude, by the haversine formula on a sphere.

Your values

Latitude, then longitude, with a comma between them, such as 51.5074, -0.1278 or 51° 30′ 27″ N, 0° 7′ 40″ W. South and west are negative.

Typed the same way. The examples are London (A) and New York (B).

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

How to use this calculator

  1. Choose what you want to work out, for example Distance between two points (great circle).
  2. Type each point as latitude, a comma and longitude, such as 51.5074, -0.1278. You can also type degrees, minutes and seconds with letters, such as 51° 30′ 27″ N, 0° 7′ 40″ W. South and west are negative.
  3. For a path or an area, add one row for each point, in order. You can paste a list of points, one on each line.
  4. Choose the Earth model and choose Calculate. You can change the unit of a result, copy the result or download it as a CSV file.

The formulas

  • Haversine formula on a sphere: h = sin²(Δφ ÷ 2) + cos φ1 × cos φ2 × sin²(Δλ ÷ 2), central angle c = 2 × atan2(√h, √(1 − h)), distance = R × c. φ is latitude and λ is longitude, in radians.
  • Mean Earth radius R1 = 6,371,008.8 m (IUGG). It is (2a + b) ÷ 3 of the reference ellipsoid. You can type another radius, such as 6,371 km.
  • WGS 84 ellipsoid: a = 6,378,137 m and 1/f = 298.257223563, its two defining constants. Distances on it come from Vincenty’s formulae (1975).
  • Area of a shape with great-circle edges: R² × the spherical excess, which each edge adds up as E = 2 × atan[tan(Δλ ÷ 2) × (tan(φ1 ÷ 2) + tan(φ2 ÷ 2)) ÷ (1 + tan(φ1 ÷ 2) × tan(φ2 ÷ 2))]. On WGS 84 the latitudes are first changed to authalic latitudes and the authalic radius is used, which keeps areas true (Snyder, Map Projections — A Working Manual, 1987).
  • Points along a route: spherical linear interpolation between the two points.
  • Length of a degree on WGS 84: latitude M × π ÷ 180 and longitude N × cos φ × π ÷ 180, with the radii of curvature M = a(1 − e²) ÷ (1 − e² sin² φ)^1.5 and N = a ÷ √(1 − e² sin² φ).

Worked example

London is at 51.5074, -0.1278 and New York at 40.7128, -74.0060. Then Δφ = -10.7946° and Δλ = -73.8782°. The haversine value is h = 0.1792364335, so the central angle is c = 0.8743089279 rad (50.09421156°).

With the mean radius of 6,371,008.8 m the great-circle distance is 5,570.23 km. On the WGS 84 ellipsoid the distance is 5,585.23 km, so the sphere is 15.0 km (0.27%) short here. The midpoint of the great circle is at 52.368440, -41.290307, over the Atlantic.

At latitude 45° on WGS 84, one degree of latitude is 111.132 km and one degree of longitude is 78.847 km.

Which model to use

The sphere is simple and is what most distance calculators use. It differs from the WGS 84 distance by up to about 0.56%: the most for short north-south lines near the equator, and less for most other lines.

The WGS 84 ellipsoid is the shape that GPS uses, and its distances are good to well under a millimetre. For the distance with the start and end azimuths, and for the reverse task (where you end up after a distance on a bearing), use the Geodesic Distance Calculator. For the bearing between two points use the Bearing Azimuth Calculator.

Limits you should know

  • Distances are the shortest way over the surface of the model at sea level. Roads, flight routes, terrain and height are not included, so a real trip is longer.
  • There is no place search and no map. Type the latitude and longitude of each place, for example from a map application. Airport codes and addresses are not read.
  • Decimal commas are not read: use a point in the numbers and a comma between latitude and longitude.
  • For areas, the outline must not cross itself; the tool does not check this. The edges are great circles (on WGS 84: great circles of the authalic sphere, which are very close to the shortest paths on the ellipsoid for fields, towns and regions).
  • Two points opposite each other on the Earth (antipodes) have no single great circle between them, so there is no midpoint and no single route.

Related tools