Math

Distance Formula Calculator

Measure the straight-line distance between two points and follow the calculation step by step.

Distance
5

Straight-line distance between the two points.

Step by step

  1. d = √((x₂ − x₁)² + (y₂ − y₁)²)
  2. d = √((3)² + (4)²)
  3. d = √(9 + 16) = √25
  4. d = 5

How it works

The distance formula comes straight from the Pythagorean theorem. The horizontal gap (x₂ − x₁) and the vertical gap (y₂ − y₁) are the two legs of a right triangle, and the distance you want is the hypotenuse: d = √((x₂ − x₁)² + (y₂ − y₁)²).

For the points (1, 2) and (4, 6), the gaps are 3 and 4. Squaring gives 9 and 16, which sum to 25, and the square root of 25 is 5. That neat 3-4-5 triangle is a classic example.

Squaring the differences means the sign of each gap doesn't matter — you always get a non-negative distance. The tool shows each squaring and the final square root so you can check the arithmetic.

Frequently asked questions

Why do we square the differences?

Squaring does two jobs: it removes any negative signs, and it sets up the Pythagorean theorem. The squared horizontal and vertical gaps add to the squared distance, so taking the square root recovers the actual length.

Does the distance change if I swap the two points?

No. Distance is symmetric — the gap from point A to point B is the same as from B to A. Swapping the points flips the sign of each difference, but squaring erases that, so the answer is identical.

Can the distance ever be negative?

Never. A distance is a length, and lengths can't be negative. The smallest possible value is 0, which happens only when the two points are exactly the same.