Distance Between Two Points

Find the straight-line distance between two points in 2D or 3D space.

What the Distance Between Two Points does

The distance formula is the Pythagorean theorem applied to coordinates: the straight-line gap is the square root of the summed squared differences along each axis. It extends to any number of dimensions.

Formula

  • 2D: d = √((x₂−x₁)² + (y₂−y₁)²)
  • 3D: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)

Inputs explained

InputUnitRequiredNotes
Dimensionsone of 2 optionsYes
x₁numberYes
y₁numberYes
z₁numberIn some modesShown Dimensions is 3D (x, y, z).
x₂numberYes
y₂numberYes
z₂numberIn some modesShown Dimensions is 3D (x, y, z).

How to use it

  1. Choose Dimensions.
  2. Enter x₁, y₁, x₂ and y₂.
  3. Fill in the remaining inputs the form shows for your choice.
  4. Select Calculate.

Worked example

Distance from (1, 2) to (4, 6).

x₁, y₁
1, 2
x₂, y₂
4, 6

√(3² + 4²) = √25 = 5.

Reading the result

  • This is the straight-line distance, which is the shortest path between two points on a flat plane.
  • The formula extends to any number of dimensions by adding another squared difference under the root.

Common mistakes

  • Forgetting to square the differences before adding them, which turns the result into something closer to a Manhattan distance.
  • Applying it to latitude and longitude. Degrees are not a flat grid, so distances on the globe need a great-circle formula instead.

Frequently asked questions

What is Manhattan distance?

The distance travelling only along axes, like navigating a city grid: |Δx| + |Δy|. It is always at least as long as the straight line.

Related calculators