Skip to content

The Distance Formula: Calculator, Proof & Worked Examples

Need the straight-line distance between two points on a coordinate plane? Use the calculator for a fast answer with every step shown, or keep reading for the formula, the Pythagorean proof, and practice problems.

Published: June 12, 2026

Distance formula calculator

Enter the coordinates of two points to find the distance between them.

Result

d=(41)2+(62)2=5d = \sqrt{(4-1)^2 + (6-2)^2} = 5

Distance is always non-negative.

A(1, 2)B(4, 6)

Step-by-step working

  1. 1.Substitute the coordinates into the distance formula.

    d=(41)2+(62)2d = \sqrt{(4 - 1)^2 + (6 - 2)^2}
  2. 2.Subtract to find the horizontal and vertical changes.

    d=(3)2+(4)2d = \sqrt{(3)^2 + (4)^2}
  3. 3.Square each difference and add them.

    d=9+16=25d = \sqrt{9 + 16} = \sqrt{25}
  4. 4.Take the square root to get the distance.

    d=5d = 5

By the Solve Formulas Editorial Team. Published June 12, 2026.

Why this calculator exists. Most online tools give you the answer and nothing else. We built this one to show every step, because on a test, knowing how you got d=5d = 5 is the whole point.

What is the distance formula?

The distance formula calculates the straight-line distance between two points A(x1,y1)A(x_1, y_1) and B(x2,y2)B(x_2, y_2) on a coordinate plane. It answers the question students ask most often: how far apart are these two points?

Distance between two points
d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Subtract the x-coordinates, subtract the y-coordinates, square both results, add them, and take the square root. That is the full distance formula.

xyA(x₁, y₁)B(x₂, y₂)|x₂ − x₁||y₂ − y₁|d
The distance d is the hypotenuse of a right triangle whose legs are the horizontal and vertical gaps between the points.

The distance formula and the Pythagorean theorem

You do not need a separate rule to memorize. Plot the two points, draw a right triangle whose hypotenuse connects them, and the legs are x2x1|x_2 - x_1| and y2y1|y_2 - y_1|. The Pythagorean theorem gives:

d2=(x2x1)2+(y2y1)2d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2

Take the positive square root and you have the distance formula. Squaring removes the sign, so you do not need absolute-value bars inside the formula.

SAT tip. When a problem gives you three coordinate pairs, find all three side lengths with the distance formula first. Then check whether the longest side squared equals the sum of the other two squared. Example: vertices (0,0)(0,0), (3,0)(3,0), (0,4)(0,4) give sides 3, 4, and 5. Since 32+42=523^2 + 4^2 = 5^2, it is a right triangle.

When to use the distance formula

You will use it whenever you have two coordinate pairs and need the length between them: checking if a triangle is isosceles (compute all three sides and compare), finding a circle's radius from its center to a point on the edge, or getting the diagonal of a rectangle on a grid.

It works with negative numbers, decimals, and fractions. Subtract carefully; squaring takes care of the signs.

How to find the distance between two points (step by step)

  1. Label your points as (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2).
  2. Subtract: compute x2x1x_2 - x_1 and y2y1y_2 - y_1.
  3. Square each difference.
  4. Add the two squares.
  5. Take the square root of the sum. That value is dd.

Walk-through with (0,0)(0, 0) and (3,4)(3, 4):

d=(30)2+(40)2=9+16=5d = \sqrt{(3-0)^2 + (4-0)^2} = \sqrt{9 + 16} = 5

Distance formula examples

Example 1: Whole-number coordinates (3-4-5 triangle)

Distance between A(1,2)A(1, 2) and B(4,6)B(4, 6):

d=32+42=25=5d = \sqrt{3^2 + 4^2} = \sqrt{25} = 5

Classic 3-4-5 right triangle. The answer is exactly 5 units.

Example 2: Negative coordinates

Between P(2,1)P(-2, -1) and Q(3,11)Q(3, 11):

Show working
d=(3(2))2+(11(1))2=52+122=169=13d = \sqrt{(3-(-2))^2 + (11-(-1))^2} = \sqrt{5^2 + 12^2} = \sqrt{169} = 13

Example 3: Decimal coordinates

Between (0.5,1.5)(0.5, 1.5) and (3.25,4.75)(3.25, 4.75):

Show working
d=2.752+3.252=7.5625+10.5625=18.1254.26d = \sqrt{2.75^2 + 3.25^2} = \sqrt{7.5625 + 10.5625} = \sqrt{18.125} \approx 4.26

Example 4: Distance from the origin

Between O(0,0)O(0, 0) and (6,8)(6, 8):

d=62+82=100=10d = \sqrt{6^2 + 8^2} = \sqrt{100} = 10

When one point is the origin, the formula simplifies to d=x2+y2d = \sqrt{x^2 + y^2}.

3D distance formula

In three dimensions, add a zz term under the root for points P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2):

d=(x2x1)2+(y2y1)2+(z2z1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

Example: P(1,2,3)P(1, 2, 3) to Q(4,6,8)Q(4, 6, 8) gives d=9+16+25=507.07d = \sqrt{9 + 16 + 25} = \sqrt{50} \approx 7.07.

Where you will see this in real life

  • Game development. Engines use vector distance (same Pythagorean form) for collision checks and pathfinding on a 2D map.
  • Data science. K-nearest neighbors and clustering measure how far apart data points are in feature space.
  • Class and tests. SAT and ACT geometry often give coordinate vertices and ask about side lengths or right triangles.

GPS apps use spherical formulas such as the haversine equation, not flat Euclidean distance, because the Earth is curved. For a homework grid, Euclidean distance is what you want.

Distance formula practice problems

Try these, then open the answers to check your work.

  1. Find dd between (0,0)(0, 0) and (3,4)(3, 4).
  2. Find dd between (1,2)(-1, 2) and (5,3)(5, -3).
  3. Find dd between (12,13)(\frac{1}{2}, \frac{1}{3}) and (32,53)(\frac{3}{2}, \frac{5}{3}).
  4. In 3D, find dd between (1,1,1)(1, 1, 1) and (4,5,6)(4, 5, 6).
  5. Triangle ABCABC has vertices A(0,0)A(0,0), B(4,0)B(4,0), C(2,3)C(2,3). Find each side length.
Show answers
  • 1. d=5d = 5
  • 2. d=617.81d = \sqrt{61} \approx 7.81
  • 3. d=531.67d = \frac{5}{3} \approx 1.67 (not 5\sqrt{5})
  • 4. d=507.07d = \sqrt{50} \approx 7.07
  • 5. AB=4AB = 4, BC=AC=13BC = AC = \sqrt{13} (isosceles)

Common mistakes to avoid

  • Forgetting to square before adding. If you got something like 7, you probably added 3+43 + 4 instead of 9+169 + 16.
  • Mishandling negatives. 3(2)=53 - (-2) = 5, not −1.
  • Taking the square root too early. Add the squared terms first, then take one square root.
  • Mixing x and y. Always subtract x from x and y from y.

Rule of thumb: distance should never be negative. If your result is negative, re-check the arithmetic inside the radical before you took the root.

Back to the geometry formulas hub.

Frequently asked questions

How do I find the distance between two points on a graph?
Subtract the x-coordinates and the y-coordinates, square both differences, add them, and take the square root. Our calculator above runs those steps for you automatically.
Does the order of the points matter?
No. Squaring removes the sign, so swapping the two points gives the same distance.
Can distance ever be negative?
No. Distance is a length, so it is zero or positive. You get zero only when both points are identical.
How is the distance formula related to the Pythagorean theorem?
The distance formula is the Pythagorean theorem on a coordinate grid. The horizontal and vertical gaps are the legs; the segment between the points is the hypotenuse.
How do I find the distance in three dimensions?
Add a z-term under the root: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). Same idea, one more leg.
What is the distance formula used for on the SAT?
Side lengths from coordinates, checking for right triangles, and finding a circle's radius from its center to a point on the edge.
How do I find the radius of a circle with the distance formula?
Apply the formula between the center and any point on the circle. That distance is the radius.
Does the distance formula work with fractions?
Yes. Subtract the coordinates as usual, then square. With fractions, keep a common denominator when subtracting the y-values so you do not mix them up.