Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem

Distance Formula Calculator

Find the straight-line distance between two points as an exact radical and a decimal.

Examples

About the Distance Formula Calculator

The distance formula is the Pythagorean theorem applied to coordinates. The horizontal and vertical differences between two points are the legs of a right triangle, and the distance is its hypotenuse.

This calculator simplifies the square root exactly, so (−2,1)(−2, 1) to (3,−3)(3, −3) gives 41\sqrt{41}, and (0,0)(0,0) to (1,3)(1, 3) gives 10\sqrt{10} rather than a rounded decimal only.

What is the distance formula?

The distance formula gives the length of the straight segment joining two points in the coordinate plane. If the points are (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), the horizontal gap between them is x2−x1x_2 - x_1 and the vertical gap is y2−y1y_2 - y_1. Draw those two gaps and they form the legs of a right triangle whose hypotenuse is the segment you want to measure.

The Pythagorean theorem then says the square of the hypotenuse equals the sum of the squares of the legs, and taking the square root gives the distance. The result is always zero or positive, it does not depend on which point you call first, and it is measured in the same units as the coordinates.

Typical uses include finding the side lengths of a triangle drawn on a grid, the radius of a circle from its center and a point on it, and the straight-line gap between two locations on a map.

How to use the Distance Formula Calculator

  1. Enter the first point (x₁, y₁).
  2. Enter the second point (x₂, y₂).
  3. Press Find distance to see the differences, their squares, the sum and the simplified root.

Formulas

Distance formula

d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Pythagorean theorem

a2+b2=c2a^2 + b^2 = c^2

Midpoint

M=(x1+x22, y1+y22)M = \left(\frac{x_1 + x_2}{2},\ \frac{y_1 + y_2}{2}\right)

Worked example: (1, 2) and (4, 6)

The worked example measures from (1, 2) to (4, 6). The differences are Δx=3\Delta x = 3 and Δy=4\Delta y = 4, their squares are 9 and 16, and the sum is 25, so d=25=5d = \sqrt{25} = 5, the familiar 3-4-5 right triangle. The calculator also lists the midpoint, (2.5, 4), and checks that d2d^2 equals Δx2+Δy2\Delta x^2 + \Delta y^2.

The solution below is generated by the same engine that powers the calculator above.

Final answer

d=5d = 5

How we read your problem

Find the straight-line (Euclidean) distance between two points in the plane.

Step-by-step solution

  1. Label the points

    (x1,y1)=(1,2),(x2,y2)=(4,6)(x_1, y_1) = (1, 2),\quad (x_2, y_2) = (4, 6)
  2. Find the horizontal and vertical differences

    Δx=3,Δy=4\Delta x = 3,\quad \Delta y = 4
  3. Square the differences and add them

    (3)2+(4)2=9+16=25(3)^2 + (4)^2 = 9 + 16 = 25
  4. Take the square root

    d=25=5d = \sqrt{25} = 5
  5. Midpoint (average of the coordinates)

    M=(1+42,2+62)=(2.5,4)M = \left(\frac{1 + 4}{2}, \frac{2 + 6}{2}\right) = (2.5, 4)

Formulas used

  • Distance formula

    d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
  • Midpoint formula

    M=(x1+x22,y1+y22)M = \left(\frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2}\right)

The distance formula is the Pythagorean theorem applied to the right triangle whose legs are the horizontal and vertical differences between the points.

Verification

  • d² = 25 matches Δx² + Δy² = 25

Detailed explanation

Exact radicals

Most pairs of points do not give a whole-number distance. From (−2, 1) to (3, −3) the differences are 5 and −4, the squares add to 41, and since 41 has no square factor the exact answer is 41≈6.4031242\sqrt{41} \approx 6.4031242. From (1, 1) to (7, 7) the sum of squares is 72, and because 72=36×272 = 36 \times 2 the calculator simplifies the root to 62≈8.48528146\sqrt2 \approx 8.4852814. Keeping the radical exact matters when the distance feeds into a further calculation, such as a perimeter or an area.

Distance, midpoint and circles

The midpoint is the average of the coordinates and lies exactly halfway along the segment, so its distance to each endpoint is d2\frac{d}{2}. The distance formula is also the equation of a circle in disguise: the points at distance rr from a center (h,k)(h, k) satisfy (x−h)2+(y−k)2=r2(x - h)^2 + (y - k)^2 = r^2. To check whether a point lies inside, on or outside a circle, compare its distance from the center with the radius.

Why squaring removes the sign

A difference such as Δy=−4\Delta y = -4 can be negative, depending on the order of the points, but a length cannot. Squaring makes every difference non-negative, so (−4)2(-4)^2 and 424^2 both give 16, and the final square root returns a positive number. This is also why swapping the two points never changes the answer. The same reasoning explains why you cannot simply add ∣Δx∣+∣Δy∣|\Delta x| + |\Delta y|: that is the distance walked along a grid of streets, which is longer than the straight line except when one difference is zero.

Common mistakes

  • Forgetting that the square of a negative difference is positive.
  • Taking the square root of each term separately: a2+b2≠a+b\sqrt{a^2 + b^2} \neq a + b.
  • Mixing an x-coordinate with a y-coordinate when subtracting.
  • Subtracting the coordinates but forgetting to square them before adding.
  • Rounding the square root too early and then using the rounded value in later steps.

Tips

  • Look for Pythagorean triples such as 3-4-5 and 5-12-13 to spot whole-number distances.
  • Distance is never negative and is zero only when the points coincide.
  • Simplify n\sqrt{n} by pulling out the largest square factor: 72=62\sqrt{72} = 6\sqrt2.
  • Horizontal or vertical segments need no formula: the distance is simply the difference of the coordinate that changes.
  • Square the distance instead of rooting it when you only need to compare two lengths.
  • Keep the exact form, such as 41\sqrt{41}, until the very last step and round only for the final answer.

Frequently asked questions

What is the distance formula?

d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}. It gives the length of the straight segment joining the two points.

How is it related to the Pythagorean theorem?

The differences in x and y form the two legs of a right triangle; the distance is the hypotenuse, so d2=Δx2+Δy2d^2 = \Delta x^2 + \Delta y^2.

Why is the answer a square root?

When Δx2+Δy2\Delta x^2 + \Delta y^2 is not a perfect square, the exact distance is irrational. The calculator simplifies the radical and also gives a decimal.

Does it matter which point I enter first when measuring distance?

No. Each difference is squared, so swapping the points gives the same distance.

Can I use negative or decimal coordinates?

Yes. Negative and decimal values are handled exactly before the final square root.

How do I find the midpoint too?

Average the x-coordinates and the y-coordinates. The calculator lists the midpoint with the distance.

How do I simplify the square root in a distance?

Pull out the largest perfect-square factor of the number under the root. The distance from (1, 1) to (7, 7) is 72=36⋅2=62\sqrt{72} = \sqrt{36 \cdot 2} = 6\sqrt2.

Does the distance formula work in three dimensions?

Yes, with a third term: d=Δx2+Δy2+Δz2d = \sqrt{\Delta x^2 + \Delta y^2 + \Delta z^2}. This calculator works with points in the plane, so enter x and y coordinates only.

How do I check whether three points form a right triangle?

Find the three side lengths with the distance formula, then test whether the squares of the two shorter sides add up to the square of the longest. If they do, the triangle has a right angle.

Measure the distance between your points

Enter two points above to get the exact distance as a simplified radical, its decimal value and the midpoint.

More math calculators