Distance Calculator

Measure the distance between two points in 2D or 3D, or between two latitude-longitude locations on Earth.

Distance between

Number entry: use a point for decimals (1.5). Commas grouped in threes are thousands separators (1,250), and a single comma such as 1,5 is read as a decimal comma. Nothing you enter leaves your device.

Showing the example values. Change the inputs and press Calculate for your own result.

Distance

5

Δx / Δy
3 / 4
Squared distance
25
Midpoint
(2.5, 4)

Working

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

About the distance calculator

The distance calculator measures the straight-line distance between two points in a 2D plane, between two points in 3D space, or between two places on Earth given by latitude and longitude.

For places on Earth it gives the spherical (haversine) distance and the more accurate ellipsoidal (Vincenty, WGS-84) distance in kilometres, miles and nautical miles, along with the initial bearing.

Who should use the distance calculator

  • Students using the distance formula.
  • Developers and analysts working with coordinates.
  • Travellers and pilots estimating straight-line distances between places.

How to use the distance calculator: what each input means

Mode
2D coordinates, 3D coordinates or latitude and longitude.
Coordinates
Plain numbers for 2D and 3D. For Earth, use decimal degrees, with north and east positive.

How the distance calculator works: method and formula

In 2D, distance is √((x₂ − x₁)² + (y₂ − y₁)²), which is Pythagoras on the coordinate differences. In 3D, a z term is added. On Earth, the haversine formula treats the planet as a sphere of mean radius 6,371.0088 km, while Vincenty's inverse formula uses the WGS-84 ellipsoid for sub-metre accuracy.

2D distance
d = √((x₂ − x₁)² + (y₂ − y₁)²)
3D distance
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
Haversine
a = sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2), d = 2R asin √a

How to read your distance calculator result

Earth distances are along the surface, not road or flight routes. The two methods typically differ by under half a percent. Initial bearing is the compass direction to set off in from the first point; the heading changes along a great-circle route.

Distance Calculator worked example

Points (1, 2) and (4, 6); (0, 0, 0) and (3, 4, 12); and London to Paris.

  1. 2D: √(3² + 4²) = 5.
  2. 3D: √(3² + 4² + 12²) = 13.
  3. London (51.5072, −0.1276) to Paris (48.8566, 2.3522): haversine 343.53 km, Vincenty 343.90 km, initial bearing 148.1°.

The London to Paris straight-line distance is about 343.9 km.

Practical uses of the distance calculator

  • Straight-line distance between two cities.
  • Distance between map or game coordinates.
  • Checking homework on the distance formula.

Assumptions and limitations of this calculator

  • Straight-line or great-circle distance only; it does not know roads, terrain or air routes.
  • Vincenty's method can fail to converge for nearly antipodal points; the spherical value is then shown.
  • Coordinates are not looked up from place names; you enter latitude and longitude.
FAQs

Distance Calculator FAQs

A formula for the great-circle distance between two points on a sphere from their latitudes and longitudes.

Need Something Built Around Your Numbers?

Code & Motions designs and builds custom calculators, dashboards and web tools for businesses. Tell us what you have in mind.