Skip to main content

DigitalCalculators.net

Distance Formula Calculator

Find the distance between two points in 2D or 3D, with the exact square root form, the midpoint and every step.

Results

ItemValue

Steps

StepWorking
Enter coordinates in the same unit. Decimals and negative numbers are fine. Answers are rounded to 6 decimal places.

Quick Answer

The distance formula is d = √((x₂ − x₁)² + (y₂ − y₁)²). For the points (1, 2) and (4, 6), the differences are 3 and 4, so d = √(9 + 16) = √25 = 5. In 3D, add (z₂ − z₁)² under the square root.

Last updated: 2 November 2026 ·How we calculate this: the distance formula

Table of Contents

How This Distance Formula Calculator Works

Choose 2D or 3D and enter the coordinates of two points. The calculator finds how far apart they are in a straight line. It shows the exact square root form, the decimal answer, the midpoint and each step.

Quick explanation: the distance formula is the Pythagorean theorem applied to coordinates.

  • Δx and Δy: the horizontal and vertical gaps between the points.
  • Exact form: the answer as a square root, before rounding.
  • Midpoint: the point exactly halfway between them.

How to Use the Distance Formula Calculator

  1. Choose 2D for points on a flat graph, or 3D for points in space.
  2. Enter the coordinates of the first point.
  3. Enter the coordinates of the second point.
  4. Press Calculate.
  5. Read the distance, exact form and midpoint, then check the steps.

Core Formulas

  • 2D distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)
  • 3D distance: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)
  • Midpoint (2D): ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

Key Terms

  • Coordinate: a number that gives a point’s position along an axis.
  • Δ (delta): the change in a value, such as Δx = x₂ − x₁.
  • Midpoint: the point exactly halfway between two points.
  • Euclidean distance: the straight-line distance between two points.

Worked Example

Find the distance between (−2, 3) and (4, −5).

  • Δx = 4 − (−2) = 6, Δy = −5 − 3 = −8
  • d = √(6² + (−8)²) = √(36 + 64) = √100
  • d = 10
  • Midpoint = (1, −1)

Real-Life Examples

  • A map grid: a park at (2, 1) km and a school at (7, 13) km are √(25 + 144) = 13 km apart in a straight line.
  • A video game: a player at (10, 4) and an enemy at (13, 8) are 5 units apart, which can decide whether they are in range.
  • A room in 3D: the corner-to-corner distance in a 12 × 9 × 8 ft room is √(144 + 81 + 64) = 17 ft.
  • Geometry homework: checking that a triangle’s sides from its corner points are 3, 4 and 5 shows it is a right triangle.

Distance Formula vs Pythagorean Theorem

  • Pythagorean theorem: a² + b² = c² for the sides of a right triangle.
  • Distance formula: the same idea, using Δx and Δy as the two shorter sides and the distance as the long side.
  • When to use which: use the distance formula when you have coordinates, and the theorem when you have side lengths.

Common Distances

Point 1Point 2Distance
(0, 0)(3, 4)5
(1, 2)(4, 6)5
(0, 0)(5, 12)13
(-2, 3)(4, -5)10
(0, 0)(1, 1)1.4142
(2, 2)(5, 5)4.2426
(0, 0, 0)(1, 2, 2)3
(1, 1, 1)(4, 5, 13)13

Tips for Using the Formula

  • Order does not matter: squaring removes any minus sign.
  • Watch negatives: subtracting a negative is the same as adding.
  • Straight line only: it gives the shortest path, not a route along roads.
  • Same units: both points must use the same scale.

Common Mistakes to Avoid

  • Forgetting to square. Square each difference before adding.
  • Adding the differences first. (3 + 4)² is not 3² + 4².
  • Losing a minus sign. 4 − (−2) = 6, not 2.
  • Forgetting the square root. √25 = 5, not 25.
  • Mixing up x and y. Keep each pair of coordinates together.

Frequently Asked Questions

d = √((x₂ − x₁)² + (y₂ − y₁)²). It gives the straight-line distance between two points.

Subtract the x values and the y values, square both, add them, and take the square root.

No. Squaring makes every part positive, so distance is zero or more.

Add the squared change in z under the square root as well.

It is the Pythagorean theorem written with coordinates.

5, because √(3² + 4²) = √25.

Average the x values and the y values: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2).

No. You get the same distance either way.

Look for square factors. √50 = √(25 × 2) = 5√2, which is about 7.071.

Only on a flat grid. For places on Earth, the curve of the planet matters, so use a great-circle distance tool.

Use (0, 0) as one point. The distance is √(x² + y²).

It measures how similar two data points are, for example in nearest-neighbor methods.

References & Sources

SourceUsed ForLink
Wikipedia, Euclidean distance The distance formula in 2D and 3D. https://en.wikipedia.org/wiki/Euclidean_distance
Wikipedia, Pythagorean theorem The basis of the formula. https://en.wikipedia.org/wiki/Pythagorean_theorem