Distance Formula – Definition, Examples and Calculator
The distance formula finds the straight-line length between two points on a graph. If the points are (x₁, y₁) and (x₂, y₂), the distance is d = √[(x₂ − x₁)² + (y₂ − y₁)²].
Quick Answer
d = √[(x₂ − x₁)² + (y₂ − y₁)²]
- d = distance between the two points
- (x₁, y₁) = the first point, (x₂, y₂) = the second point
Example: (0, 0) and (6, 8) → d = √(36 + 64) = √100 = 10 units.
The answer is always zero or positive, and it does not matter which point you call first.
What Is the Distance Formula?
The distance formula is a rule that gives the length of the line segment joining two points on the coordinate plane. It works for any two points, in any quadrant, including points with negative coordinates.
- Each point is an ordered pair (x, y): x tells you how far along the x-axis, y tells you how far up the y-axis.
- The result is the shortest path between the points: a straight line, not a path along the grid.
- Mathematicians call this length the Euclidean distance, after the Greek geometer Euclid.
The x–y grid it works on is the Cartesian coordinate plane, named after René Descartes. He linked algebra and geometry in La Géométrie (1637), which is why you can measure a shape using its coordinates.
Distance Formula Calculator
Enter two points to get the distance and the full working. The example below is already filled in: (2, 1) and (5, 5).
Distance: d = 5 units
- Subtract: x₂ − x₁ = 5 − 2 = 3 and y₂ − y₁ = 5 − 1 = 4
- Square: 3² = 9 and 4² = 16
- Add: 9 + 16 = 25
- Square root: √25 = 5
Use the calculator to check homework, not to replace it. Tests ask you to show the steps below.
Where the Distance Formula Comes From
The distance formula is the Pythagorean theorem (a² + b² = c²) written with coordinates. Draw the two points, then draw a horizontal line from one and a vertical line from the other. They meet at a right angle and make a right triangle.

- The horizontal leg (the run) is x₂ − x₁.
- The vertical leg (the rise) is y₂ − y₁.
- The slanted side d is the hypotenuse.
Put those into a² + b² = c²: (x₂ − x₁)² + (y₂ − y₁)² = d². Take the square root of both sides, and you have the distance formula.
So if you know the Pythagorean theorem, you already know this formula. The idea goes back to Pythagoras, the Greek thinker the theorem is named after.
How to Use the Distance Formula (4 Steps)
- Label the points. Call one (x₁, y₁) and the other (x₂, y₂). Either order works.
- Subtract. Find x₂ − x₁ and y₂ − y₁. Watch the signs when a coordinate is negative.
- Square and add. Square both differences and add them. A squared number is never negative.
- Take the square root. Leave it exact (like 5√2) or round it (like 7.07), as the question asks.
Why order does not matter: (5 − 2)² and (2 − 5)² are both 9. Squaring removes the sign.
Distance Formula Examples
Each example follows the same 4 steps. Try it first, then check.
Example 1: Two Positive Points
Find the distance between (2, 1) and (5, 5).
- x₂ − x₁ = 5 − 2 = 3, y₂ − y₁ = 5 − 1 = 4
- d = √(3² + 4²) = √(9 + 16) = √25 = 5 units
The legs 3 and 4 with answer 5 form a 3-4-5 Pythagorean triple. Spotting triples saves time on tests.
Example 2: Points With Negative Coordinates
Find the distance between (−3, 4) and (5, −2).
- x₂ − x₁ = 5 − (−3) = 8
- y₂ − y₁ = −2 − 4 = −6
- d = √(8² + (−6)²) = √(64 + 36) = √100 = 10 units
Subtracting a negative means adding: 5 − (−3) = 8. And (−6)² = 36, not −36.
Example 3: Answer in Simplest Radical Form
Find the distance between (1, 3) and (6, 8).
- Differences: 6 − 1 = 5, 8 − 3 = 5
- d = √(25 + 25) = √50
- Simplify: √50 = √(25 × 2) = 5√2 ≈ 7.07 units
Use 5√2 when a question asks for an exact answer. Use 7.07 (or 7.1 to the nearest tenth) when it asks for a decimal.
Example 4: Find a Missing Coordinate
The point (2, y) is 5 units from (6, 1). Find y.
- Set up: (6 − 2)² + (1 − y)² = 5²
- 16 + (1 − y)² = 25, so (1 − y)² = 9
- 1 − y = 3 or 1 − y = −3
- y = −2 or y = 4
There are two answers because one point sits above (6, 1) and one sits below. Check: (2, 4) and (2, −2) are both exactly 5 units away.
Example 5: Points on the Same Line
Find the distance between (−2, 3) and (7, 3).
Both points have y = 3, so they lie on a horizontal line. You can skip the formula and use absolute value:
- d = |7 − (−2)| = |9| = 9 units
The formula gives the same answer: √(9² + 0²) = 9. The same shortcut works on a vertical line, where the x-values match.
Distance Formula in 3D
In three-dimensional space, each point has a third coordinate, z. Add one more squared difference:
d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]
Example: Find the distance between (1, 2, 3) and (4, 6, 15). Differences: 3, 4 and 12 → d = √(9 + 16 + 144) = √169 = 13 units.

This is also the space diagonal of a box that is 3 × 4 × 12 units: the longest straight line from one corner to the opposite corner.
Distance Formula vs Midpoint and Slope Formulas
All three use the same two points, but they answer different questions.
| Formula | What it finds | Rule | Answer for (−3, 4) and (5, −2) |
|---|---|---|---|
| Distance | How far apart the points are | d = √[(x₂ − x₁)² + (y₂ − y₁)²] | 10 (a length) |
| Midpoint | The point halfway between them | M = ((x₁ + x₂)/2, (y₁ + y₂)/2) | (1, 1) (a point) |
| Slope | How steep the line is | m = (y₂ − y₁)/(x₂ − x₁) | −3/4 (a ratio) |

The distance formula also hides inside the equation of a circle. Every point (x, y) on a circle is the same distance r from the center (h, k), so (x − h)² + (y − k)² = r².
Real-Life Uses of the Distance Formula
Any time you can put two places on a grid, the distance formula gives the straight-line gap between them.
- Map grid. A school is at (1, 2) and a home is at (7, 10) on a town map where 1 unit = 1 mile. The straight-line distance is √(6² + 8²) = √100 = 10 miles.
- Walking the streets instead. On a street grid you cannot cut through blocks, so you walk 6 + 8 = 14 miles. That city-block length is called Manhattan (taxicab) distance. The distance formula gives the “as the crow flies” length, which is always the shortest.
- Sports field. An NFL field is 120 yards long (with end zones) and 53⅓ yards wide. Corner to corner: √(120² + 53.33²) ≈ 131.3 yards.
- Design and building. Architects and game designers place objects by coordinates and use the same formula to measure gaps, cable lengths or how far a character can move.
What about GPS? For short distances on a flat map, the distance formula works well. Across long distances, Earth’s curve matters. GPS tools then use latitude and longitude with the haversine formula to find the great-circle distance, the shortest path over a sphere.
Distance Formula on the SAT, ACT and Geometry Tests
You must memorize this formula. The digital SAT reference sheet lists area, volume and right-triangle facts, but not the distance formula. The ACT gives no formula sheet at all.
- Shortcut: the distance formula is just the Pythagorean theorem, so if you forget it, sketch the right triangle and use a² + b² = c².
- Spot triples: differences of 3 and 4, 5 and 12, or 8 and 15 give whole-number answers (5, 13, 17).
- Check with Desmos: the digital SAT includes the Desmos graphing calculator. Plot both points to see if your answer looks right.
- School standard: in US schools this is Common Core standard 8.G.B.8: “Apply the Pythagorean Theorem to find the distance between two points in a coordinate system.” It comes back in high school geometry and Algebra 2.
Common Mistakes to Avoid
- Mixing x and y values. Subtract x from x and y from y. Never x₂ − y₁.
- Sign errors with negatives. 4 − (−3) = 7, not 1. Write the brackets before you subtract.
- Squaring a negative wrong. (−6)² = 36. A calculator needs the brackets: type (−6)², not −6².
- Adding before squaring. √(3² + 4²) = 5, but (3 + 4)² gives 49. Square each difference first.
- Forgetting the square root. If your answer is 25 for points only 3 and 4 apart, you stopped at d².
- Dropping units. On a map or field, the answer is in miles, feet or yards, not just a number.
Practice Questions
Find the distance between each pair of points. Give exact answers and round decimals to the nearest hundredth.
- (0, 0) and (5, 12)
- (−1, −1) and (2, 3)
- (2, 5) and (8, 5)
- (1, 1) and (4, 7)
- (−4, 2) and (4, −4)
- (0, 0, 0) and (2, 3, 6) in 3D
Answers: 1) 13 · 2) 5 · 3) 6 (same y, so |8 − 2|) · 4) √45 = 3√5 ≈ 6.71 · 5) 10 · 6) √49 = 7
Want more practice on paper? Print the free Coordinate Geometry and Transformations PDF.
FAQs
What is the distance formula in geometry?
The distance formula in geometry is d = √[(x₂ − x₁)² + (y₂ − y₁)²]. It gives the straight-line length between two points on the coordinate plane.
How do you find the distance between two points?
Subtract the x-values and the y-values, square both results, add them, and take the square root. For (1, 1) and (4, 5): √(9 + 16) = 5.
Is the distance formula the same as the Pythagorean theorem?
Yes, in coordinate form. The run and rise between the points are the legs of a right triangle, and the distance is the hypotenuse.
Can distance be negative?
No. Squaring makes every term zero or positive, and a square root is never negative. A distance of 0 means the two points are the same.
What is the distance formula in 3D?
d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]. It adds the z-difference for points in space.
Is distance a vector?
No. Distance is a number with no direction (a scalar). It equals the magnitude, or length, of the vector from one point to the other.
What is the difference between the distance and midpoint formulas?
The distance formula gives a length: how far apart two points are. The midpoint formula gives a point: the spot exactly halfway between them.
Related Formulas
- Geometry formulas – every 2D and 3D formula on one page
- Pythagorean theorem – the rule behind the distance formula
- Midpoint and slope formulas – the other two-point formulas
- Free geometry formula sheet PDF
