↑↓ to move ↵ to open Esc to close Browse all tools

Distance Between Cities

Pick two cities or enter coordinates and get the distance as the crow flies in miles, kilometers and nautical miles, with the compass bearing, the midpoint and the time difference.

Two places

Start typing a city and pick it from the list, or enter a latitude and longitude, like 48.8566, 2.3522 or 48°51′24″N 2°21′08″E.

Distance
-

Straight-line distance over the Earth’s surface (as the crow flies). Driving is longer, and flights differ by their routing.

Initial bearing
-
Midpoint
-
Time difference today
-

Distance by method

UnitEllipsoid (WGS84)Sphere (haversine)

World sketch with the two places and the shortest path between them A B
Sketch in plate carrée (latitude and longitude as a grid). The gray dots are the cities in the list. Long routes look curved here, because the shortest path on a globe is a straight line on very few maps.

Runs on your device. Nothing you enter is sent to a server.

Distance Between Cities by Freebiefy, free online tools

Embed this tool on your site

Paste this code into your page. The tool runs in the visitor's browser, free and without signup. The height adjusts to the content. All tools you can embed

As the crow flies, not by road

This calculator gives the great circle distance: the shortest path between two places over the surface of the Earth, the line a crow would fly if it never turned. It is the distance you see on a globe with a piece of string. Driving distance is always longer, because roads follow valleys, coasts, bridges and borders. Flights start from the great circle, but they follow air routes, avoid closed airspace and bad weather, use the winds and need extra miles to climb and land, so flight distances differ by routing. The calculator does not estimate flight or driving times. If you know an average speed for your trip, the speed distance time calculator turns a distance into a travel time.

How the distance is calculated

The calculator works the distance out twice. The first method treats the Earth as a sphere and uses the haversine formula. The radius is the mean radius R1 = (2a + b) ÷ 3 = 6,371,008.7714 m, as listed for the Geodetic Reference System 1980, which the International Union of Geodesy and Geophysics adopted in 1979, and by the NGA for WGS84. Rounded, that is 6,371.0088 km.

Haversine
h = sin²(Δφ ÷ 2) + cos φ1 × cos φ2 × sin²(Δλ ÷ 2)
Distance on the sphere
d = 2 × R × arcsin(√h)

Here φ is the latitude and λ the longitude, both in radians. The Earth is not a perfect ball, though: from the center, the equator is about 21 km farther away than the poles. The second method, which gives the main result, uses the WGS84 ellipsoid that GPS is built on, with a semi-major axis of a = 6,378,137 m and a flattening of 1 ÷ 298.257223563 as the NGA defines them. On an ellipsoid the shortest path is called a geodesic, and there is no simple formula for it. The calculator uses the method Charles Karney published in 2013 and built into GeographicLib, which GeographicLib states is accurate to about 15 nanometers on WGS84 and which also works for places on nearly opposite sides of the Earth.

We checked the code against the published GeographicLib examples. Wellington, New Zealand (41.32° S, 174.81° E) to Salamanca, Spain (40.96° N, 5.50° W), two places on nearly opposite sides of the Earth, comes out at 19,959,679.267 m, the value in the GeographicLib documentation. JFK airport in New York to Singapore Changi comes out at 15,347,628 m with an initial bearing of 3° 18′ 29.9″, also matching to the meter.

Worked example: New York to London

From New York (40.7142° N, 74.0064° W) to London (51.5083° N, 0.1253° W) the geodesic on the WGS84 ellipsoid is 5,585.3 km, which is 3,470.5 miles or 3,015.8 nautical miles. The haversine formula on the sphere gives 5,570.3 km, 15.0 km less. You set off on a bearing of 51.2°, northeast, and the halfway point of the great circle is at 52.37° N, 41.29° W, over the North Atlantic. More city pairs, rounded:

From and toKilometersMilesSphere, kmDifference, kmStart
New York to London5,5853,4715,57015.0NE
Paris to Berlin8775458752.2ENE
New York to Los Angeles3,9442,4513,9368.7W
Los Angeles to Tokyo8,8335,4888,81419.0NW
Dubai to Singapore5,8453,6325,8450.2ESE
London to Sydney16,98910,55716,9944.7ENE

For the pairs above the two methods differ by less than 0.3%. Depending on the route the sphere comes out shorter or longer: here it is longer only for London to Sydney.

Miles, kilometers and nautical miles

One mile is exactly 1,609.344 m and one nautical mile is exactly 1,852 m, as listed in the NIST Guide to the SI. The calculator divides the distance in meters by these numbers, so 100 km are 62.14 miles or 54.00 nautical miles. The length converter handles other units.

Bearing, midpoint and time difference

The initial bearing is the direction you start in at the first place, measured clockwise from true north, with the 16-point compass name next to it, like NE for northeast. It comes from the geodesic on the ellipsoid. On a long route the direction changes along the way: from New York the path to London starts out toward the northeast and arrives in London heading east-southeast. The midpoint is the halfway point of the great circle on the sphere.

The time difference compares the clocks of the two cities today, using the time zone database in your browser, so daylight saving time is included. It needs a city from the list, because coordinates alone do not say which time zone a place uses. For other dates and more cities, use the time zone converter. The sunrise and sunset calculator uses the same city list.

Entering coordinates

For a place that is not in the list, type its latitude first and its longitude second. These formats all work:

FormatExample
Decimal degrees40.7128, -74.0060
Decimal with letters40.7128 N 74.0060 W
Degrees, minutes, seconds40°42′46″N 74°00′22″W
Without symbols40 42 46 N 74 0 22 W
Degrees and decimal minutes40°42.767′N 74°0.367′W
Decimal comma40,7128; -74,0060

North and east are positive, south and west negative. The city list holds the principal locations of the time zones in the IANA time zone database (zone.tab, public domain) with the coordinates zone.tab gives for them, to the nearest second of arc for many cities and to the nearest minute for the others.

How to use the distance calculator

  1. 1Type a city in From and pick it from the list, or enter coordinates.
  2. 2Do the same in To. The distance, bearing, midpoint and time difference update right away.
  3. 3Choose miles, kilometers or nautical miles as the main unit, then copy the result or a link to it.

Sources

Frequently asked questions

Is this the driving distance?

No. The calculator shows the straight-line distance over the surface of the Earth, often called the distance as the crow flies. Roads bend around hills, water and borders, so a drive is always longer, and how much longer depends on the route. Use a route planner for driving distances.

Is this the distance a plane flies?

It is the shortest possible path over the Earth’s surface, which is what a flight route starts from. Real flights differ: they follow air routes and airport approaches, avoid closed airspace and weather, and pick winds. That is why the distance on a ticket or a flight tracker can be longer than the number here.

Why are there two distances?

The haversine formula treats the Earth as a perfect sphere with the mean radius of 6,371.0088 km. The geodesic distance uses the WGS84 ellipsoid, the slightly flattened shape GPS is based on, and is the more accurate one. For the city pairs in the guide the two differ by less than 0.3%, which is about 15 km between New York and London.

What does the bearing mean?

The initial bearing is the compass direction you start in at the first place, measured clockwise from true north: 0° is north, 90° east, 180° south and 270° west. On a long route the direction keeps changing, because the shortest path on a globe is a curve on most maps. A magnetic compass points to magnetic north, which differs from true north by the local declination.

How do I enter coordinates?

Type the latitude first, then the longitude, in decimal degrees like 40.7128, -74.0060, or in degrees, minutes and seconds like 40°42′46″N 74°00′22″W. Negative numbers mean south and west. You can also write N, S, E and W instead of signs, and use a decimal comma if you separate the two values with a semicolon.

Why is my city not in the list?

The list holds the main cities of the world’s time zones, taken from the IANA time zone database, so many large cities that share a time zone with another city are missing. Enter the coordinates of your city instead. A map app shows them when you press and hold a place.

Is the time difference always right?

It is the difference between the two clocks today, from the time zone database built into your browser, so daylight saving time is included. On other dates it can be one hour more or less, because countries change their clocks on different days or not at all. The time zone converter shows any date.