Skip to content

Math

Distance Calculator

Enter your values and the result updates as you type. The formula and a worked example are below the calculator.

Distance between
Point 1
Point 2

Distance

5

P1P2xy

Steps

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

= √((4 − 1)² + (5 − 1)²)

= √((3)² + (4)²)

= √25

= 5

Slope and angle

ΔX = 4 − 1 = 3

ΔY = 5 − 1 = 4

Slope (m) = ΔY ÷ ΔX = 4 ÷ 3 = 1.3333333333333

Angle θ = 53.130102354156° (measured anticlockwise from the +x direction)

Equation of the line

y = 1.3333333333333x − 0.33333333333333

When x = 0, y = -0.33333333333333

When y = 0, x = 0.25

How to use

  1. Pick what to measure: two points on a flat plane (2D), two points in space (3D), or two places on the Earth given by latitude and longitude.
  2. Enter the coordinates. For places on Earth you can pick a city to fill its coordinates, or type decimal degrees, or degrees, minutes and seconds with N/S and E/W.
  3. Read the distance, the steps and, in 2D, the slope, angle and line through the points with a small graph. For Earth distances you also get miles, nautical miles and the starting compass bearing.

Formula

Plane: d = √((x₂ − x₁)² + (y₂ − y₁)²). Space: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). Earth: Lambert's formula on the WGS 84 ellipsoid, d = a(σ − f/2 (X + Y)), where σ is the angle between the points as seen from the centre of the Earth.

Example

(1, 1) and (4, 5) are 5 apart. (1, 1, 1) and (2, 2, 2) are √3 = 1.7320508076 apart. Delhi (28.6139, 77.209) to Mumbai (19.076, 72.8777) is about 1,144.5 km, or 711.2 miles, in a straight line.

The Earth distance is the shortest path over the surface, not a road or flight distance, and is accurate to roughly 10 m. Latitude must be between -90 and 90 and longitude between -180 and 180. This tool does not look up addresses or show a map, so nothing you type leaves your browser.