All Tools

Distance Formula Calculator Between Two Points

Find the distance between two points with the distance formula √((x₂ − x₁)² + (y₂ − y₁)²), with the exact radical such as √45 = 3√5 and every step, free in your browser.

Point 1
Point 2

Distance

Distance (d)
6.7082039325
Exact distance
√45 = 3√5

d = √((4 − 1)² + (8 − 2)²) = √(9 + 36) = √45 = 3√5 = 6.7082039325

Slope

Slope (m)
2
Δx and Δy
3 and 6

m = (y₂ − y₁) / (x₂ − x₁) = (8 − 2) / (4 − 1) = 6 / 3 = 2

Equation of the line

Slope-intercept form
y = 2x
y-intercept (b)
0
Point-slope form
y − 2 = 2(x − 1)
Standard form
2x − y = 0

b = y₁ − m × x₁ = 2 − 2 × 1 = 0

Midpoint

Midpoint (M)
(2.5, 5)

M = ((1 + 4) / 2, (2 + 8) / 2) = (2.5, 5)

Angle

Angle with the x-axis
63.4349488229°

θ = atan(m) = atan(2) = 63.4349488229°


Distance Formula Calculator

This page opens with the distance first. Enter two points and the calculator finds the straight-line distance between them with the distance formula, shows the squares and the sum under the root, and, for whole-number points, writes the root in simplest radical form, such as √45 = 3√5. Below the distance you also get the midpoint, the slope, the equation of the line and its angle. The points (1, 2) and (4, 8) are filled in to start.

The distance formula

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

The formula is the Pythagorean theorem in disguise. 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.

How to use it

Steps

  1. Type the first point into x₁ and y₁ and the second into x₂ and y₂.
  2. Read the distance and, for whole-number points, its exact form.
  3. Follow the step line to see each part of the formula.

Worked examples

(1, 2) and (4, 8)

Δx = 3 and Δy = 6, so d = √(9 + 36) = √45. Since 45 = 9 × 5, √45 = 3√5, which is 6.7082039325.

(−2, 3) and (4, −1)

Δx = 6 and Δy = −4, so d = √(36 + 16) = √52 = 2√13 = 7.21110255093. The minus sign disappears when Δy is squared.

Decimal points: (0.5, 1.5) and (2.5, 5.5)

Δx = 2 and Δy = 4, so d = √(4 + 16) = √20 = 4.472135955. Decimal points show only the decimal answer.

Where it is used

The distance formula measures the length of a line segment on a graph, the straight-line gap between two places on a grid map, and the size of a vector. In three dimensions the same idea adds a third square, (z₂ − z₁)², under the root. Results show 12 significant digits, and coordinates must lie between −1e150 and 1e150.

Distance and slope together

The same two points also fix the slope of the segment, Δy / Δx, and its angle with the x-axis. For (1, 2) and (4, 8) the slope is 2 and the angle is 63.4349488229°. Knowing the distance and the angle is the same as knowing the segment in polar form, which is how a navigator would describe the trip from the first point to the second: a length and a direction. The results below the distance give both, along with the midpoint of the segment.

Common mistakes

Subtract the coordinates in the same order for x and y, square the differences before adding them, and take the square root last. Adding the coordinates instead of subtracting them, or forgetting the root, are the most common slips.

Privacy

Nothing is uploaded; every calculation runs in your browser and never leaves your device.

Related tools

The full Slope Calculator puts the slope and the line's equation first, and the Midpoint Calculator puts the midpoint first. The Pythagorean Theorem Calculator solves the same right triangle from its sides.

Frequently asked questions

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²). It is the Pythagorean theorem applied to the horizontal and vertical gaps between the points. For (1, 2) and (4, 8), d = √(9 + 36) = √45 = 6.7082039325.

How is the exact distance found?

For whole-number points the sum under the root is a whole number, and the page writes it in simplest form by taking out square factors: √45 = 3√5 and √52 = 2√13.

Does the order of the points matter?

No. Swapping the points changes the signs of Δx and Δy, but squaring removes the sign, so the distance is the same.

Can I use negative or decimal coordinates?

Yes. Any numbers between −1e150 and 1e150 work. Decimal points give a decimal distance only; whole-number points also give the exact radical.

Is this the same as the length of a line segment?

Yes. The distance between the two end points is the length of the segment joining them. The page also shows the segment's midpoint and slope.

Other related tools