Skip to main content
1+1
EN
All calculators

Categories

Distance calculator

Result

Fill in the fields to see your result.

How it works

In a flat plane (2D or 3D), the distance formula is just the Pythagorean theorem extended: square each coordinate difference, add them, and take the square root. On a sphere, straight-line geometry does not apply, so the haversine formula instead computes the great-circle distance — the shortest path along the curved surface — from the two points' latitude and longitude.

The geographic mode also reports the initial bearing: the compass direction you would need to head at the start of the great-circle path (which, over long distances, is not the same as pointing straight at the destination on a flat map).

Formulas used

Distance in 2D

d = √((x₂ − x₁)² + (y₂ − y₁)²)

Distance in 3D

d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)

Haversine (great-circle) distance

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

Worked examples

Distance in a 2D plane

The distance between (1, 2) and (4, 6) is exactly 5.

Distance between two cities

Paris (48.8566°N, 2.3522°E) to London (51.5074°N, −0.1278°E) is about 343.6 km as the crow flies.

Assumptions and limits

  • The 2D and 3D modes assume a flat (Euclidean) coordinate system.
  • The geographic mode approximates the Earth as a sphere of radius 6,371 km, ignoring its slight flattening at the poles.

Frequently asked questions

Why not just use the flat-plane formula for geographic coordinates?

Latitude and longitude are angles on a sphere, not coordinates on a flat grid — a degree of longitude covers a different real-world distance near the equator than near the poles, so the flat formula would give badly wrong results over any real distance.

How accurate is the haversine formula?

It treats the Earth as a perfect sphere, which is accurate to within about 0.5% — good enough for most purposes, though a more complex ellipsoidal model (like Vincenty's formula) is used where higher precision is needed.

Why is the actual travel distance longer than the calculated distance?

This gives the shortest theoretical path — a straight line in a plane, or a great-circle arc over the globe — while roads, flight paths and terrain add detours that a straight-line calculation cannot capture.

What is bearing, and why does it change along the route?

Bearing is the compass direction of travel. On a great-circle route between distant points, the bearing actually changes continuously along the path — the "initial bearing" reported here is only the heading at the very start of the journey.

Updated