Distance Formula Calculator

The distance between two points is the long side of a right triangle: across by Δx, up by Δy. Drag the points or type coordinates.

Answer

Distance from P to Q

5

Δx3
Δy4
Midpoint(2.5, 4)
−10−10−5−5551010Δx 3Δy 4P (1, 2)Q (4, 6)

Drag P or Q (they snap to halves), or focus one and use the arrow keys.

Why this answer

  1. Across. Δx = x₂ − x₁ = 4 − 1 = 3.
  2. Up. Δy = y₂ − y₁ = 6 − 2 = 4.
  3. Pythagoras. These are the legs of a right triangle, so d² = Δx² + Δy² = 9 + 16 = 25. Squaring makes negative differences positive, so the order of the points doesn't matter.
  4. Square root. d = √25 = 5.

Put it to use

Related ideas

  • The point halfway between P and Q comes from the Midpoint Calculator.
  • How steep the segment is comes from the Slope Calculator.
  • In 3D, add a third term: d = √(Δx² + Δy² + Δz²).

How it works

The distance formula calculator finds the straight-line distance between two points, P(x₁, y₁) and Q(x₂, y₂). You type the coordinates or drag the points on the grid.

It works by turning the segment into the long side of a right triangle. The horizontal leg is Δx = x₂ − x₁, and the vertical leg is Δy = y₂ − y₁. The Pythagorean theorem then gives the distance: square both legs, add them, and take the square root.

When the result is not a whole number, the page shows the exact root, such as √61, next to its decimal value.

Δx = x₂ − x₁, Δy = y₂ − y₁d = √((x₂ − x₁)² + (y₂ − y₁)²)In 3D: d = √(Δx² + Δy² + Δz²)

Worked example: Distance from P(−2, 3) to Q(4, 11)

  1. Across: Δx = 4 − (−2) = 6.
  2. Up: Δy = 11 − 3 = 8.
  3. Square and add: d² = 6² + 8² = 36 + 64 = 100.
  4. Square root: d = √100 = 10.

Common mistakes

  • Forgetting to square the differences. Adding Δx and Δy directly gives 14 in the example above, not 10.
  • Taking the square root of each term separately. √(36 + 64) is 10, but √36 + √64 is 14.
  • Mishandling negatives. 4 − (−2) is 6, not 2. Squaring then makes every difference positive.
  • Stopping at d². The value under the root is the squared distance, so you still need the square root.

Frequently asked questions

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²). It is the Pythagorean theorem applied to the horizontal and vertical gaps between two points.

Does it matter which point I call the first one?

No. Swapping the points flips the signs of Δx and Δy, but squaring removes the sign, so the distance is the same.

How do I find the distance between two points in 3D?

Add a third squared term for the z-direction: d = √(Δx² + Δy² + Δz²). This page handles two dimensions, so use the 3D formula by hand for that case.

Why is the answer sometimes a square root instead of a whole number?

Most pairs of points give a sum of squares that is not a perfect square. For P(1, −4) and Q(6, 2), d² = 25 + 36 = 61, so d = √61 ≈ 7.8102.