Distance Formula Calculator

Calculate the distance between two points (x₁,y₁) and (x₂,y₂) using the Pythagorean theorem.

Distance Between Two Points

The formula

d = √((x₂ − x₁)² + (y₂ − y₁)²)

It returns the straight-line distance between two points on a coordinate plane.

Where it comes from

This is the Pythagorean theorem wearing different clothes. Draw a right triangle between your two points: the horizontal leg is the difference in x, the vertical leg is the difference in y, and the distance you want is the hypotenuse.

Since a² + b² = c², the hypotenuse is √(a² + b²) — which is exactly the distance formula with the legs written as coordinate differences.

Worked example

Distance from (1, 2) to (4, 6):

That's the familiar 3-4-5 triangle. Most real coordinate pairs produce an irrational result instead — the distance from (0,0) to (2,3) is √13 ≈ 3.606.

Negative coordinates

Subtraction handles them automatically, and squaring removes any sign issue. From (−3, 5) to (2, −1):

Because the differences are squared, the order of the points doesn't matter. Distance from A to B equals distance from B to A.

Three dimensions

d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)

The pattern extends to any number of dimensions: square each difference, add them, take the root.

Where it's used

Geometry and coordinate proofs, physics displacement problems, computer graphics and collision detection, navigation on a flat map, and clustering algorithms in data science — where it's known as Euclidean distance.

One limit worth knowing: on the Earth's surface this underestimates real distance over long spans, because the planet is curved. Great-circle formulas handle that case.