Distance Formula Calculator

Enter two points to find the distance between them using d = √((x₂ − x₁)² + (y₂ − y₁)²), with exact and decimal answers. For example, the distance from (1, 2) to (4, 6) is 5, and from (−3, 1) to (3, −2) it is 3√5 ≈ 6.708204.

  • Free
  • No sign-up
  • Shows the working
  • Works on phones
Dimensions
Point 1
Point 2

Whole numbers, decimals, negatives or fractions like 1/2 all work.

Try:
Distance
d = 3√5 ≈ 6.708204
(−3, 1)(3, −2) grid = 2
The dashed legs are the changes in x and y. The distance is the hypotenuse.
Δx
6
Δy
−3
d²
45
Distance (decimal)
≈ 6.708204
Exact form
3√5

Step by step

  1. Use the distance formula: d = √((x₂ − x₁)² + (y₂ − y₁)²).
  2. Change in x: x₂ − x₁ = 3 − (−3) = 6, squared: 6² = 36
  3. Change in y: y₂ − y₁ = −2 − 1 = −3, squared: (−3)² = 9
  4. Add the squares: 36 + 9 = 45
  5. Take the square root and simplify: d = √45 = 3√5 ≈ 6.708204

How to use the distance formula

  1. Subtract the x-coordinates: x₂ − x₁. Do the same for y (and z in 3D).
  2. Square each difference. Squares are never negative.
  3. Add the squares together.
  4. Take the square root of the total, and simplify the radical if it is not a perfect square.

What is the distance formula?

The distance formula gives the straight-line length between two points on a coordinate grid. It is the Pythagorean theorem written with coordinates: the horizontal change and the vertical change form the two legs of a right triangle, and the distance is the hypotenuse.

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

How do you find the distance between two points?

Here is the full working for (−3, 1) and (3, −2):

  1. Change in x: 3 − (−3) = 6. Change in y: −2 − 1 = −3.
  2. Square them: 6² = 36 and (−3)² = 9.
  3. Add: 36 + 9 = 45.
  4. Square root: √45 = √(9 × 5) = 3√5 ≈ 6.708.

The exact answer is 3√5. Teachers often ask for this simplest radical form as well as the decimal. When the sum of squares is a perfect square, like 9 + 16 = 25, the distance is a whole number (here 5).

The distance formula in 3D

In three dimensions, add the squared change in z as well:

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

For (1, 2, 3) and (4, 6, 8) the changes are 3, 4 and 5, so d = √(9 + 16 + 25) = √50 = 5√2 ≈ 7.071068.

Distance examples

PointsDistance
(0, 0) to (3, 4)5
(1, 2) to (4, 6)5
(−3, 1) to (3, −2)3√5 ≈ 6.708204
(0, 0) to (1, 1)√2 ≈ 1.414214
(2, −1) to (7, 11)13
(−4, −3) to (2, 5)10
(0, 0, 0) to (1, 1, 1)√3 ≈ 1.732051
(1, 2, 3) to (4, 6, 8)5√2 ≈ 7.071068
(2, 3, 6) to (4, −1, 18)2√41 ≈ 12.806248

Horizontal and vertical distances

When two points share an x-coordinate or a y-coordinate, you do not need the full formula. Points on the same horizontal line, like (2, 5) and (9, 5), are |9 − 2| = 7 units apart. Points on the same vertical line, like (4, −1) and (4, 6), are |6 − (−1)| = 7 units apart. The formula still works in these cases, because one of the squared differences is simply 0.

Distances are always measured in the same units as the grid. If each grid square is 1 km on a map, a distance of 3√5 ≈ 6.71 means about 6.71 km in a straight line.

Common mistakes

  • Forgetting to square negatives properly. (−3)² = 9, not −9.
  • Taking the root of each part. √(36 + 9) is √45, not √36 + √9 = 9.
  • Mixing up coordinates. Subtract x from x and y from y.
  • Forgetting the square root. 45 is d², not d.

The distance formula goes well with the midpoint calculator and the slope calculator, which describe the same segment in other ways. For triangles you already know two sides of, use the Pythagorean theorem calculator.

Frequently asked questions

What is the distance formula?

The distance between (x₁, y₁) and (x₂, y₂) is d = √((x₂ − x₁)² + (y₂ − y₁)²). It comes from the Pythagorean theorem: the changes in x and y are the legs of a right triangle and the distance is the hypotenuse.

How do you find the distance between two points?

Subtract the x-coordinates, subtract the y-coordinates, square both differences, add them and take the square root. For (1, 2) and (4, 6): √(3² + 4²) = √25 = 5.

What is the distance formula in 3D?

Add a third squared difference for z: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). For (1, 2, 3) and (4, 6, 8), d = √(9 + 16 + 25) = √50 = 5√2 ≈ 7.071068.

Does the order of the points matter?

No. Swapping the points changes the sign of each difference, but squaring makes it positive again, so the distance is the same either way.

Can a distance be negative?

No. A distance is always 0 or positive, because it is the square root of a sum of squares. It is 0 only when the two points are the same.

How do you give the distance in simplest radical form?

Simplify the square root by taking out the largest perfect square factor. √45 = √(9 × 5) = 3√5 ≈ 6.708. The square root calculator shows this step in detail.

Last reviewed November 27, 2026 by the ChalkStation team.