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.
- The central angle comes out at 35.4°.
- Distance: 6,371 km × 35.4° × π ÷ 180 = 3,936 km, or 2,445 miles.
- Initial bearing: 274°, just north of due west.
- 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.