Calculate

Point A

Point B

Examples

Results update as you type.

Result

—

The formula

In 2D, d = √((x₂−x₁)² + (y₂−y₁)²). In 3D, add (z₂−z₁)² under the root. That is the Pythagorean theorem on the coordinate differences.

d = √(Δx² + Δy²) · 3D: √(Δx² + Δy² + Δz²)

Worked example

  1. Points A(0, 0) and B(3, 4).
  2. Δx = 3 − 0 = 3, Δy = 4 − 0 = 4.
  3. d = √(3² + 4²) = √25 = 5.

Result: Distance = 5

How the distance formula works

The straight-line length between two points is the hypotenuse of a right triangle whose legs are the gaps along each axis.

Link to the Pythagorean theorem

Treat Δx and Δy (and Δz in 3D) as the legs of a right triangle. The hypotenuse d is the Euclidean distance.

Signs and point order

Squaring the differences removes sign, so swapping A and B yields the same distance. Negative coordinates and decimals work without special handling.

Units

The result uses the same unit as your axes. Optional unit labels are for display only — they do not convert values.

What this does not model

Great-circle (Earth surface) distance and GPS route length need geodetic formulas, not a flat Euclidean tool.

Interesting facts

Straight-line distance

This gives the shortest distance “as the crow flies” between two points in flat space.

Pythagorean link

The formula comes directly from the Pythagorean theorem, using axis gaps as triangle legs.

Works with negatives and decimals

Coordinates can be positive, negative, or decimal values.

Frequently asked questions

Yes. Negative x, y, or z values work normally.

No. Swapping point A and B gives the same distance.

The distance is 0.

No. Switch to 3D (x, y, z) to include a z difference under the square root.

Squaring removes sign direction and follows the right-triangle relation behind Euclidean distance.

References

  1. Distance formula in the plane — Khan Academy Euclidean distance from the Pythagorean theorem.
  2. Pythagorean theorem — NIST Digital Library of Mathematical Functions Mathematical background for Δx/Δy distance calculations.

For educational and planning use only.

Last reviewed: 2026-10-11 — Reviewed by: Editorial Team

Embed this calculator

Add this calculator to your website with a free iframe widget.

Theme

The widget stretches to the width of its container and adjusts its height automatically.