Distance Formula Calculator (Distance Between Two Points)

Enter two points to get the straight-line distance, midpoint and slope, with the formula worked out.

Enter your numbers

Results

How this calculator works

The distance formula is the Pythagorean theorem on a coordinate grid. The horizontal gap Δx and the vertical gap Δy are the legs of a right triangle, and the distance between the points is its hypotenuse: d = √(Δx² + Δy²). In three dimensions you add the Δz² term.

The midpoint is the average of the coordinates, and the slope is the rise over the run, Δy ÷ Δx.

d = √((x₂ − x₁)² + (y₂ − y₁)²) 3D: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²) Midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2) Slope m = (y₂ − y₁) / (x₂ − x₁)

Assumptions and tips

  • Gives the straight-line (Euclidean) distance on a flat grid, not travel distance on a map.

Worked example

Using the default values in the calculator above:

InputValue
Points in2D (x, y)
x₁1
y₁2
x₂7
y₂10

ResultValue
Distance10
Exact form10
Midpoint(4, 6)
Δx, Δy6, 8
Slope (Δy ÷ Δx)1.333333

Step by step:

  1. Δx = 7 − 1 = 6; Δy = 10 − 2 = 8
  2. Square and add: 36 + 64 = 100
  3. d = √100 = 10

Common mistakes to avoid

  • Subtracting x from y — pair the x-coordinates together and the y-coordinates together.
  • Forgetting to square negative differences (squaring makes them positive).

Frequently asked questions

What is the distance between (1, 2) and (7, 10)?

√(6² + 8²) = √100 = 10.

Is the distance formula the same as the Pythagorean theorem?

Yes — Δx and Δy are the legs of a right triangle and the distance is the hypotenuse.

How do I find the distance in 3D?

Add the squared difference in z: d = √(Δx² + Δy² + Δz²).

Does the order of the points matter?

No. The differences are squared, so swapping the points gives the same distance.

Sources

Anirban KunduBuilt and reviewed by Anirban Kundu, Creator & Editor · M.Sc Physics, 20 years teaching science

Last reviewed: 2026-11-05 · Editorial policy · How we build and check calculators