Distance Calculator

Distance Calculator

Find the distance between two points on a 2D plane, in 3D space, by latitude and longitude, or between two places on a live road map.

2D distance

Distance between two points (x, y) on a flat plane.

Point 1
Point 2
Result will appear here.

3D distance

Distance between two points (x, y, z) in three-dimensional space.

Point 1
Point 2
Result will appear here.

Distance by latitude & longitude

Shortest (great-circle) distance between two points on Earth's surface, given in decimal degrees.

Point 1
Point 2
Result will appear here.

Distance on a road map

Search two places, or click the map to drop pins. Shows the straight-line distance and, where a route can be found, the driving distance and time.

Tip: click anywhere on the map to set point A, then click again to set point B. Drag either pin to fine-tune it.

Calculating Distance Between Points

In Two Dimensions

To measure the straight-line distance between two points on an x-y plane, use:

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

Here, (x₁, y₁) and (x₂, y₂) represent the two points. It doesn’t matter which point you label as “first” or “second” the result stays the same as long as you keep the x and y values matched to the correct point.

Worked example: Find the distance between (1, 5) and (3, 2).

d = √[(3−1)² + (2−5)²] = √[4 + 9] = √13

Swapping the point labels gives the identical answer, since squaring removes the effect of sign.

In Three Dimensions

The same idea extends to 3D space by adding a z-coordinate:

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

Worked example: Distance between (1, 3, 7) and (2, 4, 8):

d = √[1² + 1² + 1²] = √3


Measuring Distance Across the Globe

Straight-line geometry doesn’t directly apply to a curved surface like the Earth, so two specialized formulas are commonly used instead.

The Haversine Method

This formula estimates the shortest path between two latitude/longitude points assuming the Earth is a perfect sphere.

It calculates what’s called the great-circle distance the shortest arc connecting two points along a sphere’s surface, traced by the plane that cuts through the sphere’s center.

Because the Earth actually bulges slightly at the equator (its radius is about 6,378 km there, versus roughly 6,357 km at the poles), treating it as a perfect sphere introduces a margin of error typically up to 0.5%.

Lambert’s Formula (Ellipsoidal Method)

To correct for the Earth’s slightly flattened shape, Lambert’s formula treats the planet as an ellipsoid rather than a sphere.

This approach is significantly more accurate  typically within about 10 meters, even across distances spanning thousands of kilometers.

The formula incorporates:

  • a  the Earth’s equatorial radius
  • σ  the central angle between the two points (often derived using the haversine calculation)
  • f  the Earth’s flattening coefficient
  • Correction terms X and Y, which account for how latitude affects the ellipsoid’s curvature

These correction terms rely on “reduced latitude” values (β), computed from each point’s actual latitude (ϕ) adjusted by the flattening factor.

A Note on Accuracy

It’s worth remembering that no formula gives a truly exact answer. Both haversine and Lambert’s formula are mathematical models of the Earth’s shape, and neither accounts for real-world surface variation mountains, valleys, coastlines, or elevation changes.

They calculate distance across an idealised, smooth reference shape, not the bumpy actual terrain. Lambert’s formula simply gets closer to reality by using a more accurate baseline shape (an ellipsoid) instead of a rough approximation

Leave a Reply

Your email address will not be published. Required fields are marked *