Skip to content
ENExplore Calculators

Distance Calculator

Measure distance between 2D or 3D points, and great-circle distance between coordinates.

About Distance Calculator

The 2D and 3D Euclidean distance formulas apply the Pythagorean theorem directly to coordinate differences. In 2D: d = √((x₂−x₁)² + (y₂−y₁)²). In 3D, add (z₂−z₁)². For points on a sphere (lat/lon), the haversine formula gives the great-circle distance — the shortest path along the Earth's surface, which differs significantly from straight-line distance for long ranges.

Formulas

2D Euclidean

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

3D Euclidean

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

Haversine

d = 2R arctan2(√a, √(1−a)); a = sin²(Δφ/2) + cosφ₁ cosφ₂ sin²(Δλ/2)

R
Earth's mean radius (6371 km)
φ
Latitude (radians)
λ
Longitude (radians)

Worked example

With the default values below, Distance Calculator returns Distance of 5.000000. Change any input above and every figure here is recalculated in your browser.

Inputs used

Modeone of 2D Euclidean, 3D Euclidean, Haversine (lat/lon)
2D Euclidean
x₁
0
y₁
0
x₂
3
y₂
4
z₁
0
z₂
0
Latitude 1 (°)accepts -90–90
40.7128
Longitude 1 (°)accepts -180–180
-74.006
Latitude 2 (°)accepts -90–90
51.5074
Longitude 2 (°)accepts -180–180
-0.1278

Results

Distance
5.000000
Unit
units

Step by step

  1. 1Δx= 3
  2. 2Δy= 4
  3. 3Distance= 5

Assumptions and limits

  • The result is derived only from the 11 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What is the difference between Euclidean and great-circle distance?

Euclidean distance is the straight-line 'as the crow flies' distance through space (or on a flat plane). Great-circle distance is the shortest path along the curved surface of a sphere. For geographic distances over more than a few hundred kilometres, the great-circle distance differs meaningfully from the flat-plane approximation.

Why is the haversine formula used instead of the simpler spherical law of cosines?

The cosine formula (d = R × arccos(sin φ₁ sin φ₂ + cos φ₁ cos φ₂ cos Δλ)) suffers from floating-point precision loss for very short distances. The haversine variant remains numerically stable even when the two points are only metres apart.

What is the distance between New York and London?

Using the haversine formula: New York is approximately 40.71°N, −74.01°E; London is 51.51°N, −0.13°E. The great-circle distance is approximately 5570 km (3461 miles).

Distance Calculator – Calculate Distance & Unit | Calcrivo