Skip to content
Omnikalc

GPS distance calculator: distance between two latitude and longitude points

Enter two GPS coordinates in decimal degrees to get the great-circle distance as the crow flies, the initial compass heading and a rough flight time.

Updated on
Your inputs
°

Value out of range

°

Value out of range

°

Value out of range

°

Value out of range

Results

Distance as the crow flies

2,445.6

Initial heading (bearing)

274 °

Heading west
Flight time, about (500 mph cruise + 30 min)
5:23:28
Central angle
35.395 °

Distance between two points on Earth

This calculator takes two points given as latitude and longitude in decimal degrees and returns the great-circle distance, the shortest path over the Earth’s surface, often called the distance as the crow flies. It also gives the initial compass bearing, the central angle and a rough flight time.

Coordinates in degrees, minutes and seconds must first be converted: decimal = degrees + minutes ÷ 60 + seconds ÷ 3,600. West longitudes and south latitudes are negative.

The haversine formula

With φ for latitude, λ for longitude and Δ for the differences:

  • a = sin²(Δφ ÷ 2) + cos φ1 × cos φ2 × sin²(Δλ ÷ 2)
  • central angle c = 2 × asin(√a)
  • distance = R × c, with R = 6,371 km (3,959 miles), the mean Earth radius

The initial bearing is atan2(sin Δλ × cos φ2, cos φ1 × sin φ2 − sin φ1 × cos φ2 × cos Δλ), converted to a 0 to 360° compass heading.

Worked example: New York to Los Angeles

  • New York: 40.7128° N, 74.0060° W, entered as 40.7128 and −74.006.
  • Los Angeles: 34.0522° N, 118.2437° W, entered as 34.0522 and −118.2437.
  1. The central angle comes out at 35.4°.
  2. Distance: 6,371 km × 35.4° × π ÷ 180 = 3,936 km, or 2,445 miles.
  3. Initial bearing: 274°, just north of due west.
  4. At about 500 mph plus half an hour for takeoff and landing, the flight takes roughly 5 h 20 min; real schedules are longer westbound because of headwinds.

Some great-circle distances

Route Distance
New York to Los Angeles 2,445 mi
New York to Chicago 711 mi
San Francisco to Seattle 679 mi
Miami to Boston 1,258 mi
New York to London 3,461 mi
Los Angeles to Tokyo 5,480 mi

Why straight lines on a map look curved

Flat maps distort the globe, so the shortest route usually appears as a curve bending toward the pole. That is why flights from the US to Europe pass near Newfoundland and Ireland, and why the initial bearing differs from the bearing you would read off a flat map.

Accuracy

The Earth is not a perfect sphere: it is about 21 km wider at the equator than pole to pole. The spherical formula is accurate to within about 0.5%, which is enough for travel and fitness tracking. Surveying and aviation navigation use ellipsoid models for higher precision.

Frequently asked questions

How do you calculate the distance between two GPS coordinates?

With the haversine formula, which gives the great-circle distance on a sphere. It uses the latitude and longitude differences in radians and an Earth radius of about 6,371 km, or 3,959 miles.

How far is New York from Los Angeles as the crow flies?

About 2,445 miles, or 3,936 km, between the city centers. Driving distance is around 2,800 miles because roads don't follow the great circle.

How accurate is the haversine formula?

Within about 0.5%, because the Earth is slightly flattened at the poles. That is plenty for trip planning; surveyors use ellipsoid methods such as Vincenty's for millimeter accuracy.

What is the initial bearing?

The compass direction to set off on, measured clockwise from true north. On a great circle the heading changes along the way, which is why flights from New York to Europe first head northeast.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.