GPS coordinate distance and bearing calculator

Use signed decimal degrees: north and east are positive, south and west are negative (−0.1278 means 0.1278° W). Degree signs and letters are not accepted.

The route map appears here.

Show the steps

Interactive calculation is unavailable until JavaScript loads. The formulas, worked examples and references below remain available.

Find the great-circle distance and the initial and final bearing between two latitude and longitude points, and a waypoint along the route.

How to use

Enter the start and end points in signed decimal degrees: latitude first, then longitude. North and east are positive, south and west are negative.

Choose km, m, mi or nmi.

Read the great-circle distance, the initial bearing to set off on and the final bearing on arrival (true bearings, clockwise from north).

Enter a percentage or drag the waypoint slider to find a point part-way along the route, its distance from the start and the heading there.

Open Show the steps for the formulas. Copy result copies the values; Reset restores the start.

Science

The shortest path between two points on a sphere is an arc of a great circle, the circle whose centre is the centre of the Earth. The haversine formula finds the angle between the two points as seen from that centre, and the distance is that angle in radians times the Earth's radius.

The tool uses a sphere of radius 6371.0088 km, the mean Earth radius defined by the IUGG for the GRS 80 ellipsoid. The real Earth is slightly flattened, so the result typically differs from an ellipsoidal (WGS 84) distance by less than 0.3 %, at most by about 0.5 %.

The initial bearing is the direction to set off in, measured clockwise from true north. Along a great circle the heading changes, so the final bearing on arrival is usually different. Only a rhumb line keeps one compass heading, and it is longer (except along a meridian or the equator, where both are the same).

The waypoint is the point at the chosen fraction of the distance. At 50 % it is the midpoint, usually not halfway between the latitudes and longitudes.

Points on exactly opposite sides of the Earth are antipodal: every great circle through them is equally short, so there is no single bearing. For two equal points the distance is zero and there is no bearing either.

Limitations: bearings are true, not magnetic; altitude, terrain and roads are not included; both points must use the same datum (GPS uses WGS 84).

Why does the route look curved on the map? A latitude–longitude map stretches areas near the poles, so a great circle, which is the shortest path on the globe, bends toward the nearer pole when it is drawn on the grid.

Why is my distance different from a mapping app? Apps may use an ellipsoid (typically within 0.3 %, at most about 0.5 % different), follow roads or include altitude. This tool gives the straight great-circle distance over a sphere.

How do I enter a west or south coordinate? Type it as a negative number: 74.006° W is −74.006 and 33.8688° S is −33.8688. A missing minus sign moves the point to the other hemisphere. Convert 0–360 longitudes by subtracting 360 from values above 180.

Can I enter degrees, minutes and seconds? Convert first: decimal degrees = degrees + minutes ÷ 60 + seconds ÷ 3600, then add a minus sign for south or west.

Formulas

Haversine: a = sin²(Δφ/2) + cos φ1 × cos φ2 × sin²(Δλ/2), where φ is latitude, λ is longitude and Δ is end minus start, in radians.

Distance: d = R × 2 asin(√a), with R = 6371.0088 km (IUGG mean Earth radius).

Initial bearing: θ1 = atan2(sin Δλ × cos φ2, cos φ1 × sin φ2 − sin φ1 × cos φ2 × cos Δλ), turned into 0° to 360° clockwise from north.

Final bearing: θ2 = (bearing from the end back to the start + 180°) mod 360°.

Waypoint: With δ = d/R and fraction f: A = sin((1 − f)δ)/sin δ and B = sin(fδ)/sin δ; the point is the normalised sum A × start + B × end of the two position vectors.

Examples

London 51.5074, −0.1278 to New York 40.7128, −74.0060: 5570 km; initial bearing 288.3° (WNW); final bearing 231.2° (SW). It leaves heading west-north-west and arrives heading south-west; the midpoint 52.36844° N, 41.29031° W is north of both cities.

0, 0 to 1, 0 (one degree of latitude): 111.2 km; bearing 0.0° (N). One degree along a meridian is π × 6371.0088 km ÷ 180.

Tokyo 35.6762, 139.6503 to San Francisco 37.7749, −122.4194: 8275 km; initial bearing 54.4° (NE). The route crosses the 180° meridian; the map draws it as one line.

London to New York typed as 40.7128, 74.0060 (minus sign missing): 5587 km; initial bearing 71.5° (ENE). Without the minus sign the point is in Asia: the bearing points east, though the distance looks similar.

0, 0 to 0, 180 (antipodal points): Distance: 20020 km; no single bearing. Every great circle through opposite points is a shortest route, so there is no bearing.

References

Movable Type Scripts: Calculate distance, bearing and more between latitude/longitude points

Wikipedia: Haversine formula

Wikipedia: Great-circle distance

H. Moritz: Geodetic Reference System 1980 (IAG Geodesist's Handbook)

Related tool: Angle Normalization Converter

Related tool: NMEA Checksum Calculator