About the Distance Formula calculator
This distance formula calculator finds the straight-line distance between two points, either on a flat x-y plane or in 3D space with a z coordinate. Enter the coordinates and you get the distance as a decimal and, when the numbers allow it, as an exact simplified radical such as 4√5.
The steps show the differences in each coordinate, their squares and the square root, all with your numbers. It is designed for algebra and geometry students, and for anyone working with coordinates in maps, graphics, physics or game design.
How to use it
- Choose the Space: 2D or 3D.
- Enter the first point in x₁ and y₁ (and z₁ for 3D).
- Enter the second point in x₂ and y₂ (and z₂ for 3D).
- Read the distance and its exact radical form, then follow the steps.
The formula
In two dimensions:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
In three dimensions, add the z term:
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
- (x₁, y₁, z₁) — the first point
- (x₂, y₂, z₂) — the second point
- d — the straight-line (Euclidean) distance, always zero or positive
When the sum of squares is a whole number, the square root is simplified by pulling out square factors: √80 = √(16 × 5) = 4√5.
Where the formula comes from
The distance formula is the Pythagorean theorem in disguise. Draw a horizontal line from the first point and a vertical line from the second, and you get a right triangle. The legs are the horizontal gap Δx and the vertical gap Δy, and the distance is the hypotenuse, so d² = Δx² + Δy².
For the points (1, 2) and (5, 10), Δx = 4 and Δy = 8. Then d = √(16 + 64) = √80 = 4√5 ≈ 8.944.
In 3D the idea is applied twice. First find the diagonal across the floor using x and y, then use that and the height difference in z as the legs of a second right triangle. With z₁ = 0 and z₂ = 3 added to the example above, d = √(16 + 64 + 9) = √89 ≈ 9.434.
Tips and common mistakes
Order does not matter. Because each difference is squared, (5 − 1)² and (1 − 5)² are both 16. You can subtract in either direction.
Square before adding. √(4² + 8²) is not 4 + 8. The square root of a sum is not the sum of the square roots.
Watch negative coordinates. The gap between x = −3 and x = 4 is 4 − (−3) = 7, not 1.
Straight line only. This is the distance "as the crow flies". City-block or driving distance is usually longer, and distances on the Earth's surface over long ranges need a formula for a sphere.
To find the point halfway between two points, use the midpoint calculator, and for the steepness of the line joining them, the slope calculator.
Frequently asked questions
How do you find the distance between two points?
Subtract the x values and the y values, square both differences, add them, and take the square root. From (0, 0) to (3, 4) the distance is √25 = 5.
What is the distance formula in 3D?
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). It adds the squared z difference to the 2D formula.
Can distance be negative?
No. The squares are never negative and the square root is taken as positive, so distance is always zero or more.
How do I simplify the radical answer?
Find the largest perfect square that divides the number under the root and take its root outside. √72 = √(36 × 2) = 6√2. The calculator does this for you.
Is the distance formula the same as the Pythagorean theorem?
Yes, it is the Pythagorean theorem applied to the horizontal and vertical gaps between two points.
Last updated October 24, 2026. Results are estimates for education and planning — see our disclaimer.