Key takeaways
- The distance formula is d = √[(x₂ - x₁)² + (y₂ - y₁)²].
- It's the Pythagorean theorem applied to the horizontal and vertical gaps between two points.
- Squaring removes the effect of subtraction order, so distance is always positive.
- It only gives the straight-line distance, not a walking or driving route.
In this guide
What is the distance formula?
When two points are plotted on a coordinate grid, the distance formula tells you exactly how far apart they are in a straight line. It's built from the Pythagorean theorem.
Why does the distance formula matter?
It's the foundation for measuring straight-line distance anywhere numbers can be placed on a grid: maps, games, graphics, and geometry problems alike.
The park entrance at (0, 0) and a picnic area at (6, 8) are exactly √(6² + 8²) = √100 = 10 meters apart in a straight line — the same 6-8-10 triangle you'd get from the Pythagorean theorem, just measured on a map instead of a wall.The formula
| Symbol | What it means | Example |
|---|---|---|
| d | The distance between the two points | 10 m |
| (x₁, y₁) | The first point's coordinates | (0, 0) |
| (x₂, y₂) | The second point's coordinates | (6, 8) |
How to find the distance step by step
- 1Write down both points' coordinates.
- 2Subtract the x-coordinates.
x₂ - x₁. - 3Subtract the y-coordinates.
y₂ - y₁. - 4Square both differences and add them together.
- 5Take the square root. This gives you the distance.
Now try it yourself. Change the two points in the calculator below and watch the distance update, with every step shown.
Try it yourself
Pre-filled with the example — change any value.
Common mistakes to avoid
- Skipping the square root. The formula under the root sign is the squared distance, not the actual distance.
- Mixing up x and y coordinates. Keep each point's x and y paired correctly before subtracting.
- Expecting a walking distance. This gives the straight-line ("as the crow flies") distance only, not a route around obstacles.
Tips and tricks
- Recognizing a 3-4-5 or 6-8-10 style gap between coordinates lets you find the distance without a calculator.
- To find the point exactly halfway between two points instead, use the midpoint formula calculator.
Where you'll use it in real life
- Mapping: finding how far apart two locations are on a coordinate map.
- Game development: measuring distance between objects or characters on screen.
- Geometry: checking the length of a line segment between two plotted points.
- Data analysis: measuring how "close" two data points are in a scatter plot.
Quick summary
To find the distance between two points, subtract their x-coordinates and y-coordinates separately, square both differences, add them, and take the square root. It's the Pythagorean theorem in coordinate form. Use the calculator above to check your own two points instantly.
Worked example
On a park map marked out in meters, the entrance is at point (0, 0) and the picnic area is at point (6, 8). How far away is the picnic area in a straight line?
- 01d = √[(x₂-x₁)² + (y₂-y₁)²]
- 02d = √[(6-0)² + (8-0)²]
- 03d = √[6² + 8²]
- 04d = √[36 + 64]
- 05d = √100
- 06d = 10
These numbers are pre-filled in the calculator above.
Frequently asked questions
How is the distance formula related to the Pythagorean theorem?
The horizontal gap (x₂ - x₁) and vertical gap (y₂ - y₁) between two points form the two legs of a right triangle. The [Pythagorean theorem](/calculator/pythagorean-theorem) then gives the straight-line distance as the hypotenuse.
Does it matter which point I call point 1 and which I call point 2?
No. Since both differences get squared, swapping the points gives the exact same distance.
Can the distance formula give a negative answer?
No. Distance is always zero or positive, since it comes from a square root of a sum of squares.
What if both points have the same x-coordinate?
Then the distance is simply the difference between the y-coordinates, since the x-term becomes zero — the two points lie on a vertical line.


