Math · Every step shown

Distance Formula Calculator

Find the straight-line distance between two points, in a flat 2D plane or in 3D space.

Enter your numbers

Press Solve with steps to see the answer and how to get it.

Job: Coordinate geometry
x: y:
x: y:
x: y: z:
x: y: z:
Your answer

Press Solve with steps to see the answer and every step.

How it works, examples and FAQ

2D: distance = √((x2−x1)² + (y2−y1)²). 3D: distance = √((x2−x1)² + (y2−y1)² + (z2−z1)²).

Example: (0,0) to (3,4) gives a distance of 5. In 3D, (0,0,0) to (2,3,6) gives a distance of 7.

Where does the distance formula come from?
It's the Pythagorean theorem applied to coordinates — the straight-line distance is the hypotenuse of a right triangle built from the horizontal and vertical (and, in 3D, depth) differences.

What's the distance between (0,0) and (3,4)?
5, since √(3² + 4²) = √25 = 5.

Does the formula change in 3D?
Just one more term under the square root for the z-coordinate difference: √((x2−x1)² + (y2−y1)² + (z2−z1)²).

More math calculators

Snap a photo of a problem →   All math tools →   All calculators →

These calculators show the method as well as the answer, so you can learn the steps and check your own work. If a result ever looks wrong, tell us on the Contact page with the numbers you entered.

Save or print your results

On a phone, choose Save as PDF on the next screen to keep a copy.