Distance between two points
Find the straight-line (Euclidean) distance between two points on a coordinate plane. It is a staple of geometry homework, graphics and game programming, surveying and any task that needs the shortest gap between two (x, y) locations.
How it works
The distance formula is the Pythagorean theorem applied to the horizontal and vertical gaps between the points:
distance = √((x₂ − x₁)² + (y₂ − y₁)²)
The horizontal difference (Δx) and vertical difference (Δy) form the two legs of a right triangle, and the distance is the hypotenuse. Because each difference is squared, the order of the points and any negative coordinates never change the result — the distance is always a positive number.
Example
The distance between (0, 0) and (3, 4):
Δx = 3 − 0 = 3, Δy = 4 − 0 = 4 distance = √(3² + 4²) = √(9 + 16) = √25 = 5
| Point 1 | Point 2 | Distance |
|---|---|---|
| (0, 0) | (3, 4) | 5 |
| (1, 1) | (4, 5) | 5 |
| (−2, −3) | (1, 1) | 5 |
Everything is computed in your browser — nothing is uploaded.