Distance Between Coordinates

Find the distance between two GPS coordinates.

How it is calculated

The haversine formula gives the great-circle (shortest path over the surface) distance between two points on a sphere. With latitudes φ and longitudes λ in degrees, it computes a = sin²(Δφ/2) + cos φ1 × cos φ2 × sin²(Δλ/2) and then d = 2R × asin(√a), where R = 6371 km is the mean Earth radius. The result is in kilometres.

Enter coordinates as decimal degrees: north and east are positive, south and west are negative. A latitude outside ±90 or a longitude outside ±180 gives no result. Treating the Earth as a perfect sphere introduces an error of up to roughly half a percent compared with ellipsoidal methods. The result is the straight path over the surface, not the road, rail or flight route, and it ignores altitude.

Worked example

Istanbul is at (41.0082, 28.9784) and Ankara at (39.9334, 32.8597). The latitude difference is −1.0748° and the longitude difference is 3.8813°. These go into the haversine expression for a, and then d = 2 × 6371 × asin(√a). The result is 349.36 km along the surface of the Earth.

Try this example →

Common mistakes

  • Swapping latitude and longitude. Latitude comes first and ranges from −90 to 90, longitude from −180 to 180; values outside these ranges give no result.
  • Entering degrees, minutes and seconds (41°00′29″) instead of decimal degrees.
  • Forgetting the minus sign for south latitudes and west longitudes, which puts the point on the wrong side of the globe.
  • Expecting driving distance. The road distance is usually longer than this straight-line figure.

About this calculator

This calculator uses the haversine formula to compute the great-circle distance between two points given as latitude and longitude, treating the Earth as a sphere with a radius of about 6,371 km — the shortest path a plane or ship would actually travel, not a straight line through the ground.

It's used in logistics and shipping to estimate travel distances, by developers building "distance from you" features, and by pilots, sailors and travelers curious about the true distance between two cities or coordinates.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    A good test is London (51.5074, -0.1278) to Paris (48.8566, 2.3522), which comes out near 343.6 km. Enter latitude first and longitude second, and use negative numbers for south and west. If your source gives degrees, minutes and seconds, convert with degrees + minutes / 60 + seconds / 3600. The result is a straight line over the surface, so a road or flight route will be longer. Which kind of trip are you measuring?

Popular calculators

All Calculators