Distance Formula Calculator

Distance Formula Calculator

Calculate the straight-line distance between two points in 2D or 3D space.

Last updated: June 2026 | By Patchworkr Team

Distance

Enter all coordinates as real numbers.

What is the Distance Formula?

The distance formula measures the straight-line separation between two points.

2D: d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
3D: d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)

These formulas follow directly from the Pythagorean theorem.

How to Use

1. Choose 2D or 3D mode.

2. Enter the coordinates for both points.

3. Check the live distance result and formula preview.

Worked Example

For points (0, 0) and (3, 4):

d = sqrt((3 - 0)^2 + (4 - 0)^2)

d = sqrt(9 + 16) = sqrt(25) = 5

The calculator should show 5.

FAQ

Can I use negative coordinates?

Yes. The squares make the direction irrelevant.

Is the distance ever negative?

No. A square root of squared differences is never negative.

Does point order matter?

No. Swapping the points gives the same distance.

What if both points are the same?

The distance is 0.

Related Tools