Distance Formula Calculator

Find the distance between two points in the coordinate plane as a decimal and in exact simplified-radical form, with Δx, Δy and the steps.

How we test our calculators
Distance —
Exact form —
Δx (x₂ − x₁) —
Δy (y₂ − y₁) —
Step-by-step —

What is a distance formula calculator?

The distance formula gives the straight-line distance between two points in the coordinate plane. For points (x₁, y₁) and (x₂, y₂), the horizontal gap Δx and the vertical gap Δy are the legs of a right triangle, and the distance between the points is its hypotenuse. So the distance formula is the Pythagorean theorem written in coordinates.

This distance formula calculator takes the four coordinates and returns the Distance as a decimal, rounded to six places, and the Exact form as a simplified square root, such as 2√13 instead of 7.211103, whenever Δx² + Δy² is a whole number up to 10¹². It also shows the two differences, Δx (x₂ − x₁) and Δy (y₂ − y₁), and a Step-by-step line with the whole calculation, so you can compare it with your own working line by line.

Finding the distance between two points with the Pythagorean theorem is Common Core Grade 8 standard 8.G.B.8, and high school geometry uses the same formula to find perimeters and areas from coordinates (G-GPE.B.7). Two easy slips in hand calculations are a dropped minus sign and a radical that is not fully simplified; the Step-by-step line and the Exact form help you catch both.

Formula

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

or, in shorter form, d = √(Δx² + Δy²), with Δx = x₂ − x₁ and Δy = y₂ − y₁.

Why it works

Draw a horizontal line from one point and a vertical line from the other. They meet at a right angle, at (x₂, y₁), and form a right triangle whose legs are |Δx| and |Δy| long. By the Pythagorean theorem, the hypotenuse, which is the segment between the two points, has length √(Δx² + Δy²).

Signs and order

Δx and Δy can be negative, depending on which point you enter first, but squaring makes both terms positive, so the distance is the same in either order and is never negative. The calculator shows Δx and Δy with their signs and wraps negative values in parentheses when it squares them, as in (−6)² = 36.

Exact form

When Δx² + Δy² is a whole number, the calculator takes every square factor out of the root:

Δx² + Δy²Exact formDecimal
82√22.828427
183√24.242641
202√54.472136
453√56.708204
505√27.071068
522√137.211103

A perfect square such as 25 or 100 gives a whole-number distance. If the sum is not a whole number, which can happen with decimal coordinates, the exact form shows a dash.

Special cases

If the two points share an x-coordinate, the distance is just |Δy|; if they share a y-coordinate, it is |Δx|. If they are the same point, the distance is 0.

Worked example

Example 1: an answer in simplified radical form

Find the distance between (−2, −1) and (4, 3).

  1. Δx = 4 − (−2) = 6 and Δy = 3 − (−1) = 4.
  2. Δx² + Δy² = 36 + 16 = 52.
  3. d = √52. Because 52 = 4 × 13, √52 = √4 × √13 = 2√13.
  4. As a decimal, d ≈ 7.211103.

The step line reads Δx = 4 − (-2) = 6, Δy = 3 − (-1) = 4 → d = √(Δx² + Δy²) = √(6² + 4²) = √52 = 7.211103.

Example 2: negative coordinates

Find the distance between (−3, 2) and (5, −4).

  1. Δx = 5 − (−3) = 8. Subtracting a negative number adds it.
  2. Δy = −4 − 2 = −6. Negative, because the second point is lower.
  3. d = √(8² + (−6)²) = √(64 + 36) = √100 = 10.

The exact form is 10, a whole number, because 100 is a perfect square. The legs 6 and 8 with hypotenuse 10 are a 3-4-5 right triangle scaled by 2. If you enter the points the other way round, Δx becomes −8 and Δy becomes 6, and the distance is still 10.

Example 3: decimal coordinates

Find the distance from (0, 0) to (1.5, 2.5).

  1. Δx = 1.5 and Δy = 2.5, so Δx² + Δy² = 2.25 + 6.25 = 8.5.
  2. d = √8.5 ≈ 2.915476. The exact form shows a dash, because 8.5 is not a whole number.

To get an exact answer, double both coordinates first: from (0, 0) to (3, 5) the calculator gives √34 ≈ 5.830952. Halving that gives the original distance, d = √34 ÷ 2 ≈ 2.915476, which matches.

How to use this calculator

  1. Enter the first point in x₁ and y₁.
  2. Enter the second point in x₂ and y₂. Include minus signs; decimals are fine.
  3. Read the Distance for a decimal answer, or the Exact form if the answer must be a simplified radical.
  4. Check Δx and Δy against your own subtraction, then follow the Step-by-step line.

Common mistakes

  • Losing a minus sign. 4 − (−2) is 6, not 2.
  • Squaring a negative without parentheses. (−6)² = 36, but −6² is read as −(6²) = −36.
  • Taking the square root of each term. √(36 + 16) is √52, not 6 + 4 = 10.
  • Mixing up coordinates. Subtract x from x and y from y, never x₁ from y₂.
  • Stopping before the radical is simplified. √52 is correct but not finished; 2√13 is.

What the tool does and does not do

  • It works in two dimensions. For three, add a Δz² term under the root; see the distance formula in 3D and higher dimensions.
  • The answer is in the same unit as the coordinates, and both axes must use the same unit and scale.
  • The exact form needs Δx² + Δy² to be a whole number.

For why the two formulas are the same, read the distance formula vs the Pythagorean theorem, and for practice reducing radicals, simplified radicals. To find a missing side from side lengths rather than coordinates, use the Pythagorean theorem calculator; for the point halfway between the same two points, use the midpoint calculator.

Sources

Frequently asked questions

Does it matter which point I enter first?

No. Swapping the points changes the signs of Δx and Δy but not their squares, so the distance stays the same. From (5, −4) to (−3, 2) or from (−3, 2) to (5, −4), the distance is 10.

Why are Δx or Δy negative?

They are signed differences: Δx is negative when the second point is to the left of the first, and Δy is negative when it is lower. The calculator shows the signs because they matter for slope and direction. For distance they disappear when squared, so the distance itself is never negative. It is 0 only when the two points are the same, and then the exact form is 0 as well.

Why does the exact form show a dash?

The calculator simplifies the root only when Δx² + Δy² is a whole number. With decimal coordinates such as (0, 0) and (1.5, 2.5), the sum is 8.5, so there is no whole number to simplify. Multiply every coordinate by the same number to make them whole, find the exact form, then divide by that number, as in Example 3.

How do I find a distance in three dimensions?

Add the third difference under the square root: d = √(Δx² + Δy² + Δz²). This calculator handles two dimensions only. For points (0, 0, 0) and (3, 4, 12), the result is √(9 + 16 + 144) = √169 = 13.

How do I find the perimeter of a shape from its vertices?

Find the length of each side with the distance formula and add them up. For the triangle with vertices (0, 0), (4, 0) and (1, 3), the sides are 4, √18 = 3√2 ≈ 4.242641 and √10 ≈ 3.162278, so the perimeter is 4 + 3√2 + √10 ≈ 11.4049. That is the kind of problem in Common Core standard G-GPE.B.7.

How can I tell whether three points form a right triangle?

Find the three side lengths, then check whether the squares of the two shorter sides add up to the square of the longest. For (0, 0), (2, 4) and (6, 2), the calculator gives sides of 2√5, 2√5 and 2√10, so the squared lengths are 20, 20 and 40. Since 20 + 20 = 40, the triangle is a right triangle, with the right angle at (2, 4), the vertex opposite the longest side. Comparing the squares avoids rounding: the decimals 4.472136 and 6.324555 would not match exactly.

Can I use it with latitude and longitude?

Not for an accurate distance on the ground. Latitude and longitude are angles measured on a curved surface, not lengths on a flat grid, so putting them into the formula does not give a distance in miles or kilometers. The formula works on flat coordinate systems where both axes use the same unit, such as a graph, a floor plan or a map grid.

Is the distance formula the same as the Pythagorean theorem?

Yes, applied to coordinates. Δx and Δy are the legs of a right triangle and the distance is the hypotenuse, so d² = Δx² + Δy² is a² + b² = c² with different letters. If you already know the side lengths instead of coordinates, the Pythagorean theorem calculator solves directly.