Distance Formula Calculator

Distance between the points5.00
Midpoint(2.50, 4.00)
Horizontal change (Δx)3.00
Vertical change (Δy)4.00
How this was calculated
  1. Horizontal change Δx = 4.00 − 1.00 = 3.00; vertical change Δy = 6.00 − 2.00 = 4.00.
  2. The distance formula is Pythagoras in disguise: sqrt(3.00² + 4.00²) = 5.00.
  3. The midpoint sits halfway along both axes at (2.50, 4.00).

A distance formula calculator finds the straight-line distance between two points in a 2D coordinate plane. Enter the coordinates (x1, y1) and (x2, y2), and the tool applies the distance formula: the square root of ((x2 - x1)² + (y2 - y1)²). This is the Pythagorean theorem applied to the horizontal and vertical changes. For example, between (1, 2) and (4, 6) the changes are 3.00 and 4.00 and the distance is exactly 5.00, a 3-4-5 right triangle. Between (-2, 3) and (3, -1) the changes are 5.00 and -4.00 and the distance is 6.40. When the horizontal change is 0, as between (2, 5) and (2, 9), the distance is simply the vertical gap, 4.00. The calculator can also identify the midpoint, which averages the coordinates: ((x1 + x2)/2, (y1 + y2)/2).

The distance formula is the accepted standard for measuring separation between two points because it is rooted in the Pythagorean theorem, a foundational principle of geometry. Signs never matter for the distance itself because both changes are squared, so direction disappears and only separation remains. This mathematical reliability makes it the universal method used in classrooms, engineering, and navigation. This page shows the formula, step-by-step workings, worked examples and sources so you can verify every result. With clear calculations and proven examples, you can trust the accuracy of each answer and understand exactly how the result was reached.

Worked examples

A 3-4-5 triangle

Primary result: 5.00 — between (1, 2) and (4, 6), the classic 3-4-5 right triangle. (1 · 2 · 4 · 6)

Distance between the points5.00
Midpoint(2.50, 4.00)
Horizontal change (Δx)3.00
Vertical change (Δy)4.00

Across quadrants

Primary result: 6.40 — from (−2, 3) to (3, −1), crossing both axes. (-2 · 3 · 3 · -1)

Distance between the points6.40
Midpoint(0.50, 1.00)
Horizontal change (Δx)5.00
Vertical change (Δy)-4.00

A vertical pair

Primary result: 4.00 — same x, so the distance is just the y gap. (2 · 5 · 2 · 9)

Distance between the points4.00
Midpoint(2.00, 7.00)
Horizontal change (Δx)0.00
Vertical change (Δy)4.00

The distance formula is Pythagoras

The distance formula is Pythagoras. When you plot two points on a coordinate plane, you can always build a right triangle between them. One leg of that triangle represents the horizontal change between the points, and the other leg represents the vertical change. The straight-line distance you want to find is simply the hypotenuse of that right triangle. That is exactly what a distance formula calculator computes behind the scenes.

The distance between (x1, y1) and (x2, y2) is the square root of ((x2 - x1)² + (y2 - y1)²). This is the Pythagorean theorem applied to the horizontal and vertical changes. You square the difference in x-values, square the difference in y-values, add those squares together, and take the square root of the result. Signs never matter for the distance itself because both changes are squared — direction disappears, only separation remains. A horizontal change of -4 produces the same squared value as a change of 4.

This works for any pair of points. Verified: between (1, 2) and (4, 6) the changes are 3.00 and 4.00 and the distance is exactly 5.00 — a 3-4-5 right triangle — with midpoint (2.50, 4.00). Verified: between (-2, 3) and (3, -1) the changes are 5.00 and -4.00 and the distance is 6.40, with midpoint (0.50, 1.00). Notice that the negative vertical change of -4.00 does not affect the result; squaring it produces the same contribution as a positive change would.

When the two points share the same x-value or the same y-value, the triangle collapses into a single line segment and the calculation becomes even simpler. Verified: between (2, 5) and (2, 9) the horizontal change is 0 and the distance is simply the vertical gap, 4.00. No squaring or square roots are needed when one leg of the triangle has zero length. The distance formula still produces the correct answer, but you can read the result directly from the coordinate that differs.

The midpoint averages the coordinates: ((x1 + x2)/2, (y1 + y2)/2). This gives you the point that sits halfway along the hypotenuse, dividing the distance into two equal segments. Understanding that the distance formula is Pythagoras makes the calculation feel less like memorization and more like geometry you can visualize on any grid.

Worked examples

The distance formula calculator above gives you instant answers, but walking through a few verified examples helps you see exactly how the arithmetic works. The distance between (x1, y1) and (x2, y2) is the square root of ((x2 - x1)² + (y2 - y1)²). That expression is the Pythagorean theorem applied to the horizontal and vertical changes between the two points. The midpoint averages the coordinates: ((x1 + x2)/2, (y1 + y2)/2).

Take the points (1, 2) and (4, 6). The horizontal change is 4 - 1 = 3.00, and the vertical change is 6 - 2 = 4.00. Squaring both gives 9 and 16, which sum to 25, and the square root of 25 is exactly 5.00. This is a classic 3-4-5 right triangle, so the math checks out with no rounding at all. The midpoint is ((1 + 4)/2, (2 + 6)/2), which simplifies to (2.50, 4.00).

Now consider (-2, 3) and (3, -1). The horizontal change is 3 - (-2) = 5.00, and the vertical change is -1 - 3 = -4.00. Signs never matter for the distance itself because both changes are squared — direction disappears, only separation remains. The squares are 25 and 16, summing to 41, and the square root of 41 is approximately 6.40. The midpoint is ((-2 + 3)/2, (3 + -1)/2), which equals (0.50, 1.00).

A third case shows what happens when the two points line up vertically. For (2, 5) and (2, 9), the horizontal change is 0 because both x-values are identical. When one change is zero, the formula collapses: the distance is simply the vertical gap, 4.00. No squaring or square roots are needed, though the formula still produces the same result if you plug the numbers in.

Point 1Point 2Horizontal changeVertical changeDistanceMidpoint
(1, 2)(4, 6)3.004.005.00(2.50, 4.00)
(-2, 3)(3, -1)5.00-4.006.40(0.50, 1.00)
(2, 5)(2, 9)04.004.00(2.00, 7.00)

Finding the midpoint too

A distance formula calculator can also help you find the midpoint between two points. The midpoint formula is straightforward: ((x1 + x2) / 2, (y1 + y2) / 2). You simply average the x-coordinates to get the midpoint's x-value, then average the y-coordinates to get its y-value. This works because the midpoint sits exactly halfway between the two original points along both axes.

To see how this works, take the points (1, 2) and (4, 6). The x-values average to (1 + 4) / 2 = 2.50, and the y-values average to (2 + 6) / 2 = 4.00. So the midpoint is (2.50, 4.00). You can verify this by measuring the distance from each original point to the midpoint. The distance between (1, 2) and (4, 6) is exactly 5.00 — a 3-4-5 right triangle — so each half should be 2.50. Measuring from (1, 2) to (2.50, 4.00) gives changes of 1.50 and 2.00, and the distance is 2.50. Measuring from (2.50, 4.00) to (4, 6) gives the same changes and the same distance of 2.50. Both halves match, confirming the midpoint is correct.

The same averaging method works with negative coordinates. Between (-2, 3) and (3, -1), the midpoint is ((-2 + 3) / 2, (3 + (-1)) / 2) = (0.50, 1.00). The overall distance between these points is 6.40, with changes of 5.00 and -4.00. Signs never matter for the distance itself because both changes are squared — direction disappears, only separation remains. But signs do matter for the midpoint, so keep them in mind when adding coordinates together.

When the two points share the same x or y coordinate, the midpoint still follows the same averaging rule. Between (2, 5) and (2, 9), the horizontal change is 0 and the distance is simply the vertical gap, 4.00. The midpoint is (2.00, 7.00), which sits halfway up the vertical line. Each half measures 2.00, which is exactly half of the total distance. Using a distance formula calculator to check both halves gives you a quick way to confirm any midpoint you compute.

Common mistakes

When you use a distance formula calculator, two classic errors trip people up more than any others: forgetting to take the square root at the end, and adding the horizontal and vertical changes instead of squaring them. The distance between (x1, y1) and (x2, y2) is the square root of ((x2 - x1)² + (y2 - y1)²) — the Pythagorean theorem applied to the horizontal and vertical changes. If you stop after adding the squared changes, you have a sum of squares, not a distance. The square root is what converts that sum back into a single straight-line length.

A related mistake is adding the raw changes themselves — say, 3 plus 4 — and calling that the distance. That gives 7, not 5. The formula requires that each change be squared first, then summed, then rooted. Only after the root do you get the true separation. The verified example between (1, 2) and (4, 6) shows this clearly: the changes are 3.00 and 4.00, and the distance is exactly 5.00 — a 3-4-5 right triangle. Skip the squares and the root, and you never arrive at 5.

One thing that is not a mistake: subtracting in mixed order inside the squares. You might compute (x2 - x1) for one coordinate and (x1 - x2) for the other, and that is perfectly fine. Signs never matter for the distance itself because both changes are squared — direction disappears, only separation remains. The verified example between (-2, 3) and (3, -1) confirms this: the changes are 5.00 and -4.00, and the distance is 6.40. The negative sign on the second change vanishes once it is squared, so the result is the same regardless of which point you treat as the starting point.

A subtler error shows up when the two points share a coordinate. Between (2, 5) and (2, 9) the horizontal change is 0 and the distance is simply the vertical gap, 4.00. Some users plug this into the full formula, see a zero term, and second-guess themselves. The formula still works — 0 squared is 0, the sum is 16, and the square root is 4. Trust the arithmetic rather than switching to a shortcut halfway through.

FAQs

What is the distance between (1, 2) and (4, 6)?

Exactly 5.00. The x changes by 3 and the y changes by 4, forming a classic 3-4-5 right triangle. The distance formula squares those changes, adds them, and takes the square root, giving 25 under the root and 5.00 as the straight-line distance.

Does the order of the points matter?

No. Squaring erases the sign of each change, so reversing the points gives the same result. For example, (-2, 3) to (3, -1) and the reverse both give 6.40. The squared differences are identical either way, so the order you enter the points never affects the distance.

How do I find the midpoint?

Average the x's and the y's separately. For (1, 2) and (4, 6), add the x values and divide by 2 to get 2.50, then add the y values and divide by 2 to get 4.00. The midpoint is (2.50, 4.00), sitting exactly halfway between the two points.

What if the points share an x or a y?

The distance collapses to the other axis's gap. For example, (2, 5) to (2, 9) share the same x, so only the y values differ. The distance is exactly 4.00. The same logic applies when the y values match: the distance equals the difference in x values.

Can distance be negative?

Never. Distance is a square root of a sum of squares, so it is always zero or positive. The smallest possible distance is 0, which happens when the two points coincide. Since squares are never negative and the square root is never negative, distance cannot be negative.

Where is the distance formula used outside class?

Anywhere coordinates meet. GPS straight-line distances, game physics, robotics path lengths and screen-pixel geometry all run on it. Any application that tracks positions in a coordinate system relies on the distance formula to measure how far apart two points are, making it a core tool far beyond classroom math.

Sources

Related calculators

Midpoint Calculator
The point exactly halfway between two points — with the distance between them and the slope of the line through them as checks.
Slope Calculator
Slope, angle, distance and midpoint between two points, plus the full equation of the line through them — the whole coordinate-geometry answer in one go.
Pythagorean Theorem Calculator
Find the hypotenuse from two legs, or a missing leg from the hypotenuse — with area and perimeter of the triangle thrown in.
Arc Length Calculator
The length of a circular arc from radius and angle — plus the sector area, the chord length and the slice's share of the whole circle.