Distance Between Two Points Calculator

Calculate the exact distance between two coordinates with simplified square roots, decimal answers, and Pythagorean right triangle graphs.

Point A (P₁)
Point B (P₂)

Accepts integers, decimals, fractions (e.g. 3/4), and negative values.

Try:
Exact Distance (d): 4√5 ≈ 8.9443
Δx (Horizontal Change)
4
Δy (Vertical Change)
8
Squared Distance (d²)
80
Show the work (step-by-step)

Pythagorean Right Triangle

Visualizing points and distance

  • Distance segment
  • Point A
  • Point B

The distance formula

The distance formula measures the straight-line span between two coordinate points. We write the points as (x₁, y₁) and (x₂, y₂). The formula calculates the exact length between them:

d = √((x₂ − x₁)² + (y₂ − y₁)²)

First, find the horizontal step Δx = x₂ − x₁. Next, find the vertical step Δy = y₂ − y₁. Then, square both numbers and add them together. Finally, take the square root of that sum.

How the formula comes from the Pythagorean theorem

The distance formula comes directly from the Pythagorean theorem: a² + b² = c².

Plot two points on a grid. You can build a right triangle between them. Draw a flat horizontal line from the first point. Then draw a vertical line up or down to the second point. The flat base has length a = |x₂ − x₁|. The upright side has length b = |y₂ − y₁|.

The straight line connecting the two points is the hypotenuse c. Using c² = a² + b² gives c = √(a² + b²). This gives the exact distance formula.

Drawing the right triangle helps you see both leg lengths clearly. Each leg follows the grid lines directly. You can count grid squares along the bottom and side. Then Pythagoras gives the diagonal distance across.

Worked example

Working through coordinate examples step by step clarifies how the negative signs resolve under the squares:

Example 1: Finding the distance between A(−3, 8) and B(9, 3)

Calculate the exact distance and approximate decimal length between point A(−3, 8) and point B(9, 3).

  1. Step 1: Identify the coordinates. Set x₁ = −3, y₁ = 8, x₂ = 9, and y₂ = 3.
  2. Step 2: Find the horizontal difference (Δx). Subtract x₁ from x₂:
    Δx = x₂ − x₁ = 9 − (−3) = 9 + 3 = 12
  3. Step 3: Find the vertical difference (Δy). Subtract y₁ from y₂:
    Δy = y₂ − y₁ = 3 − 8 = −5
  4. Step 4: Square both differences. Squaring any real number yields a positive result:
    (Δx)² = 12² = 144
    (Δy)² = (−5)² = 25
  5. Step 5: Add the squared differences. Sum the two areas:
    d² = 144 + 25 = 169
  6. Step 6: Take the principal square root. Since 169 is 13², the distance is exact:
    d = √169 = 13 units

Example 2: Simplifying a non-perfect square radical between P(−2, 4) and Q(4, 10)

Find the exact simplified radical distance between P(−2, 4) and Q(4, 10).

  1. Step 1: Find the coordinate spans. Δx = 4 − (−2) = 6, and Δy = 10 − 4 = 6.
  2. Step 2: Sum the squares. (Δx)² + (Δy)² = 6² + 6² = 36 + 36 = 72.
  3. Step 3: Simplify the radical. Look for the largest square factor of 72. Since 72 = 36 × 2, pull √36 out:
    d = √72 = √(36 × 2) = 6√2 units ≈ 8.4853 units

Common Pythagorean triples reference table

When coordinate differences form whole integer legs of right triangles, the straight-line distance is also a clean whole integer. These sets of three integers are known as Pythagorean triples:

Sample Coordinate Spans Forming Common Pythagorean Triples
Triple Family Horizontal Span |Δx| Vertical Span |Δy| Sum of Squares (d²) Exact Distance (d) Sample Coordinate Pair
3-4-5 Triangle 3 units 4 units 3² + 4² = 9 + 16 = 25 5 units (1, 2) to (4, 6)
5-12-13 Triangle 5 units 12 units 5² + 12² = 25 + 144 = 169 13 units (−1, 1) to (4, 13)
8-15-17 Triangle 8 units 15 units 8² + 15² = 64 + 225 = 289 17 units (2, −3) to (10, 12)
7-24-25 Triangle 7 units 24 units 7² + 24² = 49 + 576 = 625 25 units (0, 5) to (7, 29)
9-40-41 Triangle 9 units 40 units 9² + 40² = 81 + 1600 = 1681 41 units (3, 2) to (12, 42)
20-21-29 Triangle 20 units 21 units 20² + 21² = 400 + 441 = 841 29 units (−5, 0) to (15, 21)

Common mistakes when calculating distance between two points

Keep your calculations accurate by watching for these five frequent mistakes:

  • Keeping a negative sign after squaring: When Δy equals −5, squaring it gives (−5)² = +25. Writing −25 is a common mistake on handheld calculators. Remember that squaring any real number always yields a positive result.
  • Splitting the square root across addition: You cannot split a root over a plus sign. The expression √(a² + b²) never equals a + b. For example, √(9 + 16) equals √25 = 5. It does not equal 3 + 4 = 7. Always add the squares before taking the square root.
  • Forgetting the final square root: Adding the two squared changes gives d², which is the square of the distance. You must take the square root at the very end to find the actual distance d.
  • Subtracting instead of adding squares: The Pythagorean formula adds the two leg squares: a² + b² = c². Never subtract the two squared numbers under the square root.
  • Mixing up x and y values: Always subtract x-values from x-values and y-values from y-values. Never subtract an x-coordinate from a y-coordinate.

Everyday uses of the distance formula

Students use the distance formula in many standard math and science tasks:

  • Finding map distances: You can place towns on a coordinate grid to find the direct straight-line distance between them.
  • Measuring screen sizes: Computer screens and phone displays are measured along their diagonal corner-to-corner length.
  • Perimeter of geometric shapes: You can find the lengths of all sides of a polygon on graph paper, then add them together.
  • Checking circle radiuses: The distance from any point on a circle to its center point gives the circle radius.

How to simplify the square root

When d² is not a perfect square, write the exact answer by factoring out square numbers:

  • Factoring √80: The number 80 equals 16 times 5. Since 16 is a square number (4²), pull 4 outside: √80 = √(16 × 5) = 4√5.
  • Factoring √52: The number 52 equals 4 times 13. Since 4 is a square number (2²), pull 2 outside: √52 = √(4 × 13) = 2√13.
  • Square roots that cannot simplify: When a number has no square factors bigger than 1, like √2 or √13, the root is already simplified.

Distance vs displacement vs slope

Coordinate geometry uses three closely related terms to describe two points:

Comparison of Geometric Quantities Between Two Points
Property Formula Directional Sign Meaning
Distance (d) d = √(Δx² + Δy²) Always positive (or zero) Total physical length of the segment
Displacement Vector (Δx, Δy) Can have positive or negative components Net change in position from start to end
Slope (m) m = Δy / Δx Positive, negative, zero, or undefined Rate of vertical rise per horizontal run

Distance in three dimensions (3D space)

In three-dimensional space with points A(x₁, y₁, z₁) and B(x₂, y₂, z₂), the distance formula adds a third squared term:

d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)

This formula comes from using the Pythagorean theorem twice in a row. First, find the diagonal along the floor. Next, use that floor diagonal and the height to find the 3D space diagonal.

After determining the length between your endpoints, you can find the halfway point to locate its center. You can also construct a perpendicular bisector through that center, or write the line in slope-intercept form to see where it crosses the y-axis. With two known points, you can also derive the line equation from two points, or check our slope calculator to see the rise and run.

For textbook lessons on distance on a coordinate grid, consult OpenStax College Algebra on coordinate graphing. You can also review right triangles in OpenStax Elementary Algebra.

Interactive Pythagorean Right Triangle

Adjust legs a and b to see the squares built on each side and observe how Area(a²) + Area(b²) always equals Area(c²).

Horizontal Leg a = 4 (Area a² = 16) | Vertical Leg b = 3 (Area b² = 9) ⟹ Hypotenuse c² = 25 (c = 5)

Maintained by the SlopeCalculator.cc Editorial Team · Updated

Distance between two points FAQs

What is the distance formula between two points?

The distance formula is d = √((x₂ − x₁)² + (y₂ − y₁)²). It computes the straight-line span between points (x₁, y₁) and (x₂, y₂) using the Pythagorean theorem.

Can the distance between two points ever be negative?

No. Distance is a physical geometric length and is always greater than or equal to zero. It equals zero only when both points occupy the exact same coordinate.

Does the order of the two points matter in the distance formula?

No. Because the horizontal and vertical differences (x₂ − x₁) and (y₂ − y₁) are squared, flipping their signs produces identical positive squared values.

Why does this calculator show both a square root and a decimal?

In mathematics and engineering, an exact radical like 4√5 is precise and prevents rounding errors, whereas a decimal like 8.9443 is useful for real-world measurements.

How is distance related to the slope of a line?

Both calculations use the same horizontal change Δx = x₂ − x₁ and vertical change Δy = y₂ − y₁. Slope computes the ratio m = Δy / Δx, while distance computes the hypotenuse d = √(Δx² + Δy²).

How do you find distance if points have fraction coordinates?

Subtract the fractions using a common denominator to find Δx and Δy, square each resulting fraction, sum them, and take the square root of the final rational fraction.