TTKTheTextKit

Distance Between Two Coordinates

Enter the latitude and longitude of two points, or pick a city, and get the shortest distance between them over the surface of the Earth in kilometers, miles and nautical miles. You also get the initial bearing from the first point to the second and back, the midpoint along the route, and the angle between the points at the center of the Earth. Coordinates can be decimal degrees, with a hemisphere letter, or in degrees, minutes and seconds. Everything runs in your browser.

Point A
Point B
Distance
5,570.23 km
Along the great circle, in kilometers
In miles
3,461.18 mi
In nautical miles
3,007.68 nmi
Initial bearing
51.2 degrees
NE, clockwise from north, from A to B
Bearing back
288.3 degrees
WNW, from B to A
Midpoint
52.3684, -41.2903
52 deg 22 min 6.4 s N, 41 deg 17 min 25.1 s W
Angle at the center
50.094 degrees
Between A and B, seen from the middle of the Earth

This finds the shortest distance over the surface between two points, the great-circle distance, from their latitude and longitude. It uses the haversine formula on a sphere with the mean radius of the Earth, 6371.0088 km, so a degree of latitude is 111.195 km and the longest possible distance, between opposite points, is 20,015 km. The Earth is slightly flattened, so the answer can differ from a calculation on the ellipsoid by up to about half a percent, and it is the distance as the crow flies, not by road or air route. Write a coordinate as decimal degrees such as 40.7128 or -74.006, with a hemisphere letter such as 74.006 W, or as degrees, minutes and seconds such as 40 42 46 N. Latitude runs from -90 to 90, and longitude from -180 to 180, with west and south negative. The initial bearing is the compass direction to set off in, and because a great circle bends on a flat map, the bearing changes along the way. A nautical mile is exactly 1.852 km and a mile is 1.609344 km. Everything runs in your browser.

Related Tools

[6 suggestions]

About the Distance Between Two Coordinates

The shortest path between two points on a sphere is an arc of a great circle, and its length comes from the haversine formula: hav(theta) = hav(lat2 - lat1) + cos(lat1) cos(lat2) hav(lon2 - lon1), where hav(x) = sin^2(x / 2), and the distance is the radius times theta. The tool uses the mean radius of the Earth, 6,371.0088 km, so one degree of latitude is 111.195 km and two opposite points are 20,015 km apart. New York at 40.7128, -74.006 and London at 51.5074, -0.1278 are 5,570.23 km, 3,461.18 miles or 3,007.68 nautical miles apart, and the initial bearing is 51.2 degrees, north-east, with the way back at 288.3 degrees. The midpoint of that route is at 52.3684, -41.2903, and the angle at the center is 50.09 degrees. For the example on Wikipedia, the White House to the Eiffel Tower, the same formula with its radius of 6,371.2 km gives 6,161.6 km. The Earth is slightly flattened, so a calculation on a sphere can differ from one on the ellipsoid by up to about half a percent, which is fine for most uses but not for surveying. It is the distance as the crow flies, not by road, rail or the route of a plane. A mile is 1.609344 km and a nautical mile is exactly 1.852 km. Latitude runs from -90 to 90 and longitude from -180 to 180, with south and west negative, and you can write 40.7128 N or 74 0 21.6 W instead. The bearing changes along a great circle, so it is the direction to set off in.

How do I find the distance between two coordinates?▾

Enter the latitude and longitude of both points. The tool applies the haversine formula on a sphere of radius 6,371.0088 km and gives the great-circle distance, which is the shortest path over the surface.

What coordinate formats can I use?▾

Decimal degrees such as 40.7128 and -74.006, decimal degrees with a letter such as 74.006 W, or degrees, minutes and seconds such as 40 42 46 N. Marks such as the degree sign, the apostrophe and the quote are read as spaces.

How accurate is the distance?▾

It treats the Earth as a sphere, so it can differ from a calculation on the real ellipsoid by up to about 0.5 percent. That is a few tens of kilometers on a long route, which is fine for planning but not for surveying.

What is the initial bearing?▾

It is the compass direction, in degrees clockwise from north, to head in at the first point to follow the great circle. The bearing changes along the way, so the direction at the end is not the reverse of the start.

Is this the driving or flying distance?▾

No. It is the straight line over the surface, the shortest distance between the two points. Roads, railways and flight paths are longer because of the terrain, the routes and the wind.