Overview

The distance formula gives the straight-line distance between two points on a graph. It's the Pythagorean theorem in coordinates.

Enter x and y for both points.

Worked examples

InputsResult
x10y10x23y24Distance: 5
Show 2 more examples
x1-2y11x24y2-7Distance: 10
x11.5y12x24y28Distance: 6.5

Distance by y2

With the calculator's starting values, the distance is 5. The table shows how it changes with the y2.

y2Distance
23.61
2.53.91
34.24
3.54.61
4starting value5
4.55.41
55.83
5.56.26
66.71

Other inputs: x1: 0 · y1: 0 · x2: 3. Change them in the calculator above for your own numbers.

How it works

The horizontal and vertical gaps form the two shorter sides of a right triangle, and the distance is its hypotenuse. Squaring removes negative signs, so the order of the points doesn't matter.

The formula

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

Practical tips

  • (0, 0) to (3, 4) is 5, the classic 3-4-5 triangle.
  • (−2, 1) to (4, −7) is √(36 + 64) = 10.
  • For three dimensions, add (z₂ − z₁)² under the root.

Frequently asked questions

Does the order of points matter?

No, the distance is the same both ways.

Can distance be negative?

No, it's always zero or positive.

How is this related to the midpoint?

The midpoint is halfway along this same line.