The distance between two points (x1, y1) and (x2, y2) is the straight line joining them, given by the distance formula: d = √((x2 − x1)² + (y2 − y1)²). For (0, 0) and (3, 4), that's √(3² + 4²) = √25 = 5. It's the Pythagorean theorem applied to the horizontal and vertical gaps between the points.
Distance Calculator — distance between two points
From (0, 0) to (3, 4).
- (0, 0)
- (3, 4)
- d = 5
Quick examples
How it's calculated
- d = √((x₂ − x₁)² + (y₂ − y₁)²)
- x1
- = 0
- y1
- = 0
- x2
- = 3
- y2
- = 4
- 5
How it works
The distance formula gives the straight-line distance between two points in the plane. It comes straight from the Pythagorean theorem: the horizontal gap (x₂ − x₁) and vertical gap (y₂ − y₁) are the two legs of a right triangle, and the distance is its hypotenuse:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
Square each gap, add them, and take the square root. Because the differences are squared, the sign doesn't matter — the order of the two points makes no difference to the answer, and distance is never negative.
Worked example
Find the distance from (0, 0) to (3, 4). The horizontal gap is 3 and the vertical gap is 4:
d = √(3² + 4²) = √(9 + 16) = √25 = 5
That's the 3-4-5 right triangle again. Sliding both points over — say (1, 1) to (4, 5) — keeps the same gaps (3 and 4) and so the same distance, 5. Points that aren't a neat triple give an irrational distance: (0, 0) to (1, 1) is √2 ≈ 1.4142.
Frequently asked questions
How do I use the distance formula?
- Subtract the x-coordinates and the y-coordinates to get the two gaps, square each, add them, and take the square root. For (2, 1) and (5, 5): √((5−2)² + (5−1)²) = √(9 + 16) = √25 = 5. The subtraction order doesn't matter because you square the results.
Why is the distance formula just the Pythagorean theorem?
- Because the two points and the corner where their horizontal and vertical lines meet form a right triangle. The coordinate gaps are the legs, and the distance you want is the hypotenuse — so √(leg² + leg²) is exactly a² + b² = c² solved for c.
Does the order of the points matter?
- No. Swapping the points flips the sign of each gap, but squaring removes the sign, so you get the same distance either way. Distance from A to B always equals distance from B to A.
What about points on a straight horizontal or vertical line?
- Then one of the gaps is zero and the formula reduces to the other gap. Two points with the same y (like (2, 3) and (9, 3)) are just |x₂ − x₁| = 7 apart; two with the same x reduce to the vertical gap. The formula still works — it just simplifies.
How is this different from the Pythagorean theorem calculator?
- They use the same arithmetic, but the inputs differ. The Pythagorean calculator takes the two **legs** of a right triangle directly; this one takes two **points** (four coordinates) and computes the legs from them first. Use this when you have coordinates, that one when you have side lengths.
Can it find distance in 3D?
- The same idea extends: in three dimensions you add a (z₂ − z₁)² term under the root, d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²). This calculator handles the common 2D (plane) case; add the z-term by hand for 3D.
How we know this is right
- Last reviewed
- Aug 5, 2026
- Precision
- Rounded to 4 decimal places.
Sources
- Wolfram MathWorld Distance — Wolfram MathWorld: "In the plane, the distance between points (x1,y1) and (x2,y2) is given by the Pythagorean theorem", d = √((x2−x1)² + (y2−y1)²) · Reviewed Aug 5, 2026