#distance#haversine#coordinates#great circle#bearing

How to Calculate the Distance Between Two Coordinates (Haversine Explained)

Learn how to calculate the distance between two GPS coordinates using the haversine formula, with a worked example, the initial bearing, and why real routes are always longer.

by GPS Pins Team3 min read

You have two GPS coordinates — how far apart are they? The answer is a single formula used by pilots, sailors, and every mapping app: the haversine formula, which computes the great-circle distance across the Earth's surface. Here is how it works, with a real example you can verify.

Straight Line on a Sphere: the Great Circle

On a flat map, the shortest path between two points is a straight line. On a sphere, it is an arc of a great circle — the circle you get by slicing the sphere through its center and both points. This is why long-haul flights between, say, Paris and Tokyo arc over Siberia instead of following a straight line on the map: the "curved" route is actually the shortest one.

The Haversine Formula

Given two points with latitude φ and longitude λ (in radians):

a = sin²(Δφ/2) + cos φ₁ · cos φ₂ · sin²(Δλ/2)
d = 2R · asin(√a)

where R is the Earth's mean radius, 6,371,008.8 meters. The formula treats the Earth as a sphere, which introduces an error of only about 0.5% versus the true ellipsoidal shape — negligible for almost every practical purpose.

Worked Example: Seoul to Busan

  • Seoul: 37.5665, 126.9780
  • Busan: 35.1796, 129.0756

Step by step:

  1. Δφ = 35.1796 − 37.5665 = −2.3869° → −0.04166 rad
  2. Δλ = 129.0756 − 126.9780 = 2.0976° → 0.03661 rad
  3. a = sin²(−0.02083) + cos(0.6557) · cos(0.6140) · sin²(0.01831) ≈ 0.000651
  4. d = 2 × 6,371,008.8 × asin(√0.000651) ≈ 325.1 km

The actual driving distance between the two cities is roughly 400 km — the straight-line figure is always the floor, never the road estimate.

Initial Bearing: Which Way to Go

The same two points also define an initial bearing — the compass direction you would face at the start:

θ = atan2( sin Δλ · cos φ₂ , cos φ₁ · sin φ₂ − sin φ₁ · cos φ₂ · cos Δλ )

For Seoul → Busan this gives about 144°, i.e. southeast. Note the word initial: on long routes the bearing changes continuously as you follow the great circle. A flight from Paris to Los Angeles starts out heading northwest even though Los Angeles is southwest of Paris on a flat map.

Why Real Routes Are Longer

The great-circle distance is the "as the crow flies" number. Real journeys add:

  • Roads and rails that follow terrain, valleys, and property lines
  • Shipping lanes constrained by coastlines, canals, and traffic separation
  • Flight paths shaped by air corridors, weather, and jet streams

As a rule of thumb, driving distance in developed road networks runs about 20–40% above the great-circle distance.

Skip the Math

If you just need the number, our free distance calculator does all of this in one click: click two points on the map (or type coordinates or addresses), and get the great-circle distance in kilometers, miles, or nautical miles plus the initial bearing. To convert coordinate formats first, use the coordinate converter.

Related Posts

#UTM#coordinates#GIS

What Is the UTM Coordinate System? Zones, Easting, and Northing Explained

Understand the UTM (Universal Transverse Mercator) coordinate system: how its 60 zones work, what easting and northing mean, and when to use UTM instead of latitude/longitude.

3 min read
Read More
#GPS#coordinates#navigation

How to Use GPS Coordinates: Opening Them in Map Apps and Converting to Addresses

Learn how to open GPS coordinates in Google Maps, Apple Maps, and Kakao Maps, and how reverse geocoding turns latitude and longitude into a readable street address.

6 min read
Read More
#GPS#latitude#longitude

Latitude and Longitude: The Complete Guide

Everything you need to know about latitude and longitude - from basic concepts to advanced calculations. Learn how these coordinates define every location on Earth with precision.

12 min read
Read More