How to Calculate Distance Formula (Distance Between Two Points)

October 3, 2026•3 min read

How to Calculate Distance Formula (Distance Between Two Points)

How to Calculate Distance Formula (Distance Between Two Points)

The distance formula measures the straight-line distance between two points on a graph. It is the Pythagorean theorem written in coordinates, and it appears everywhere from geometry homework to mapping and game design. This guide shows how to calculate distance formula problems step by step.

The distance formula

For two points (x1, y1) and (x2, y2):

d = √((x2 − x1)² + (y2 − y1)²)

Find the horizontal gap and the vertical gap, square each, add them, and take the square root.

Why the distance formula works

Draw a horizontal line from one point and a vertical line from the other, and they meet at a right angle. The two gaps are the legs of a right triangle and the distance is the hypotenuse, so a² + b² = c² gives the formula directly.

The Pythagorean theorem calculator solves the same right triangle when you know two of its sides.

How to calculate distance formula problems: distance between two points

  1. Subtract the x-coordinates: Δx = x2 − x1.
  2. Subtract the y-coordinates: Δy = y2 − y1.
  3. Square both differences and add them.
  4. Take the square root.

Worked example 1

Find the distance between (1, 2) and (4, 6). Δx = 3 and Δy = 4, so d = √(9 + 16) = √25 = 5.

Worked example 2: negative coordinates

Find the distance between (−3, 4) and (2, −8). Δx = 2 − (−3) = 5 and Δy = −8 − 4 = −12. Squaring removes the sign: d = √(25 + 144) = √169 = 13.

The distance formula calculator works out the distance and the midpoint for any two points, in two or three dimensions.

Distance formula in 3D

Add a third term for the z-coordinates:

d = √(Δx² + Δy² + Δz²)

From (1, 2, 3) to (4, 6, 15): Δx = 3, Δy = 4, Δz = 12, so d = √(9 + 16 + 144) = √169 = 13.

The midpoint formula

Coordinate geometry problems often ask for the midpoint too. Average the coordinates: M = ((x1 + x2) ÷ 2, (y1 + y2) ÷ 2). The midpoint of (1, 2) and (4, 6) is (2.5, 4).

Distance formula examples

Point 1 Point 2 Δx, Δy Distance
(0, 0) (3, 4) 3, 4 5
(1, 2) (4, 6) 3, 4 5
(−3, 4) (2, −8) 5, −12 13
(2, 1) (5, 5) 3, 4 5

Common mistakes

  • Forgetting the square root. Δx² + Δy² is the distance squared.
  • Sign errors with negatives. Subtracting a negative adds: 2 − (−3) = 5.
  • Adding the gaps directly. 3 + 4 = 7 is the walking distance along the grid, not the straight line.

Distance formula problems often lead into circles, where the distance from the centre is the radius; see how to find diameter from circumference.

For more maths techniques without a calculator, read how to calculate logarithms without a calculator.

Check any coordinate answer in seconds with a free online calculator from CalculateGuide.