Skip to content
CalcTide logo
Education & Math

Distance Formula Calculator

The distance between (0, 0) and (3, 4) is 5 units. This distance formula calculator measures the straight-line distance between two points on a 2D coordinate plane. Enter the x and y coordinates of the first point and the second point to get the result.

Education & MathBy

Quick answer

The distance formula finds the length of the straight line between two points.

What this tells you

  • The distance formula finds the length of the straight line between two points.
  • It uses the horizontal change (x2 - x1) and the vertical change (y2 - y1).
  • The result is the square root of the sum of those two changes squared.
  • Distances are rounded to 4 decimal places.

How to Use

  1. 1Enter the x and y coordinates of the first point (x1, y1).
  2. 2Enter the x and y coordinates of the second point (x2, y2).
  3. 3Click Calculate to get the distance between the two points.

How It Works

Formula

d = sqrt((x2 - x1)^2 + (y2 - y1)^2)

The distance formula comes from the Pythagorean theorem. The horizontal change (x2 - x1) and the vertical change (y2 - y1) form the two legs of a right triangle, and the distance between the points is the hypotenuse. Squaring each change, adding them, and taking the square root gives the straight-line distance.

Calculation note: values are processed in the order shown above, using the current input units.

Worked Examples

Distance from (1, 2) to (4, 6)

X11
Y12
X24
Y26
Result5

The change in x is 4 - 1 = 3 and the change in y is 6 - 2 = 4. Square each value to get 9 and 16, add them to get 25, then take the square root to get 5.

Distance from (0, 0) to (5, 12)

X10
Y10
X25
Y212
Result13

The change in x is 5 and the change in y is 12. Square each value to get 25 and 144, add them to get 169, then take the square root to get 13.

Example Distances

Common point pairs and the straight-line distance between them.

Point 1Point 2Distance
(0, 0)(3, 4)5
(1, 2)(4, 6)5
(-2, -3)(1, 1)5
(0, 0)(5, 12)13

Common mistakes

  • Forgetting to square the differences. You must square both the change in x and the change in y before adding them, otherwise the result is wrong.
  • Sign errors with negative coordinates. When a coordinate is negative, subtracting it adds a positive value, so 1 - (-2) = 3, not -1.
  • Swapping x and y values. Keep the x coordinates together and the y coordinates together, and do not mix a point's x value with the other point's y value.

Frequently Asked Questions

The distance formula is d = sqrt((x2 - x1)^2 + (y2 - y1)^2). It gives the straight-line distance between two points on a coordinate plane by taking the square root of the squared horizontal change plus the squared vertical change.
Subtract the x values to get the horizontal change and subtract the y values to get the vertical change. Square both results, add them together, then take the square root. For example, from (1, 2) to (4, 6) the changes are 3 and 4, so the distance is sqrt(9 + 16) = 5.
The distance between (0, 0) and (3, 4) is 5 units. The change in x is 3 and the change in y is 4, so the distance is sqrt(3^2 + 4^2) = sqrt(9 + 16) = sqrt(25) = 5.
Yes, the distance formula is derived from the Pythagorean theorem. The horizontal and vertical changes between the two points act as the legs of a right triangle, and the distance is the hypotenuse, so a^2 + b^2 = c^2 becomes the distance formula.
No, distance is never negative. The differences are squared before the square root is taken, which removes any negative sign, so the result is always zero or a positive number.
In 3D you add the squared change in z to the formula, giving d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2). This calculator covers 2D points only, so it uses just the x and y coordinates.
It estimates distance formula calculator outputs using the visible inputs and formula assumptions on this page.

Explore More in Education & Math