Distance Between Points Calculator
Straight-line distance between two points using the distance formula.
Input sheet
DIY at your own risk. Calcora's calculators and guides are general estimates and information only — not professional, engineering, legal, or safety advice. Always verify local building codes and permit requirements, and hire a licensed pro for electrical, gas, plumbing, structural, or any work you're not fully comfortable doing yourself.
The distance between two points is the length of the straight line connecting them — the shortest path from one to the other. It's the foundation of coordinate geometry and shows up in navigation, physics, graphics, and machine learning.
How it works
Distance = √((x₂ − x₁)² + (y₂ − y₁)²), the Pythagorean theorem applied to the horizontal and vertical gaps.
The distance formula is the Pythagorean theorem in disguise. The horizontal gap (Δx = x₂ − x₁) and the vertical gap (Δy = y₂ − y₁) form the two legs of a right triangle, and the straight-line distance is the hypotenuse. Squaring the gaps before adding them is what makes signs irrelevant — a leftward gap and a rightward gap of the same size contribute equally.
Because the differences are squared, the result is always zero or positive, and the order of the points doesn't change the answer. This same idea extends to 3D by adding a (z₂ − z₁)² term inside the square root.
Distance = √( (x₂ − x₁)² + (y₂ − y₁)² ) — square the horizontal gap and the vertical gap, add them, then take the square root.
Worked examples
Distance between (1, 2) and (4, 6). → 5.0000 units
Δx = 3, Δy = 4, so distance = √(3² + 4²) = √(9 + 16) = √25 = 5.
Distance between the origin (0, 0) and (5, 12). → 13.0000 units
Δx = 5, Δy = 12, so distance = √(25 + 144) = √169 = 13.
Tips & gotchas
- If you only need to compare distances (which point is closer), skip the square root and compare the squared distances — it's faster and gives the same ranking.
- Watch your subtraction signs, but remember the squaring cancels them out, so a sign slip on a single difference won't change the final length.
- For points on a map given in latitude/longitude, this flat-plane formula is an approximation only — over long distances use the haversine (great-circle) formula instead.
- A distance of exactly zero means the two points are identical.
FAQ
Why does the formula square the differences?
Squaring removes the sign so direction doesn't matter, and it sets up the Pythagorean relationship — the squared distance equals the sum of the squared legs.
Does the order of the two points change the distance?
No. Swapping the points flips the sign of each difference, but squaring erases that, so the distance is identical either way.
Can the distance ever be negative?
No. Squared terms are never negative and a square root returns a non-negative value, so distance is always zero or positive.
Related calculators
Percentage Calculator · Percent Change Calculator · Average (Mean) Calculator · Ratio Calculator · Exponent Calculator