DISTANCE BETWEEN COORDINATES CALCULATOR

Distance between coordinates calculator

Enter two latitude/longitude points, get the distance.

°
°
°
°

How is the distance between two coordinates calculated?

With the haversine formula for the shortest path over the Earth’s surface (the great circle), using the IUGG mean Earth radius of 6,371.0088 km.

How far is New York from Los Angeles?

From 40.7128, −74.0060 to 34.0522, −118.2437: about 2,445.6 miles (3,935.8 km) in a straight line over the Earth.

How accurate is it?

The Earth is slightly flattened, so a sphere can be off by up to about half a percent over long distances. For surveying, use an ellipsoid method.

How do I enter west longitudes and south latitudes?

As negative numbers: Los Angeles is at longitude −118.2437.

What is the initial heading?

The compass direction to start in from the first point. Along a great circle the heading changes as you go.

How do I enter degrees, minutes and seconds?

Convert to decimal degrees first: degrees + minutes ÷ 60 + seconds ÷ 3600. A latitude of 40°42′46″ N is 40 + 42/60 + 46/3600 = 40.7128, the New York figure above. South and west are negative. The DMS calculator converts both ways.

How long is one degree of latitude or longitude?

On this sphere one degree of latitude is 111.2 km (69.1 mi) everywhere, which agrees with the USGS figure of about 69 miles. A degree of longitude shrinks toward the poles: at 38° N it is 87.6 km (54.4 mi) here, against about 54.6 miles in the USGS table for the flattened Earth.

How are miles and nautical miles related to kilometers?

Exactly: 1 mile is 1.609344 km and 1 nautical mile is 1.852 km (NIST SP 811, Appendix B.8). New York to Los Angeles is 3,935.8 km, 2,445.6 mi or 2,125.1 nautical miles.

The formulas and what they assume

With latitudes φ and longitudes λ in radians, the haversine formula sets a = sin²(Δφ ÷ 2) + cos φ₁ × cos φ₂ × sin²(Δλ ÷ 2) and the distance d = 2R × arcsin(√a). The starting heading is θ = atan2(sin Δλ × cos φ₂, cos φ₁ × sin φ₂ − sin φ₁ × cos φ₂ × cos Δλ), turned into a compass angle from 0° to 360° (Chris Veness, Movable Type Scripts). The radius is the IUGG mean radius R₁ = (2a + b) ÷ 3; with the WGS 84 semi-axes of 6,378.137 and 6,356.752 km that is 6,371.0088 km. The whole method treats the Earth as a sphere. Veness puts the resulting error typically at up to 0.3%, and up to 0.55% for routes crossing the equator, so for a precise survey line use an ellipsoidal method instead.

Worked example: two points on the 35th parallel

Veness’s own example takes 35° N, 45° E and 35° N, 135° E. It gives 7,871.8 km (4,891.3 mi) with an initial heading of 60.2°, about 60° as on his page. The heading on arrival is 119.8°, so the route bends. Following the parallel itself, a circle of radius R × cos 35°, would cover 8,197.7 km, about 4% farther.

Common mistakes

Leaving out the minus sign for west and south is the most damaging: Los Angeles at 118.2437 instead of −118.2437 lands in China and the answer jumps from 3,936 km to 11,607 km. Typing degrees-minutes-seconds as if they were decimals is subtler: 40°42′46″ written as 40.4246 instead of 40.7128 moves the point by about 32 km. And remember that the result is the straight line over the surface; a road or a flight route will be longer.

Sources: Chris Veness, Movable Type Scripts, “Calculate distance, bearing and more between Latitude/Longitude points” (haversine, bearing, accuracy); NIST Special Publication 811, Appendix B.8 (mile and nautical mile in meters); H. Moritz, “Geodetic Reference System 1980” (IUGG mean radius R₁ = (2a + b) ÷ 3); NGA, World Geodetic System 1984 (ellipsoid parameters); USGS, “How much distance does a degree, minute, and second cover on your maps?” Related tools: DMS calculator, distance formula calculator, travel time calculator and angle converter. How we check our calculators.