Boneyard Tools

Distance Formula Calculator

Enter the coordinates of two points and get the distance between them, the midpoint of the segment and the slope of the line through them.

How to use the distance formula

  1. Enter the x and y of the first point.
  2. Enter the x and y of the second point.
  3. Read the distance, the midpoint and the slope of the line.

Examples

Two points

(1, 2) and (4, 6)
distance 5, midpoint (2.5, 4), slope 1.3333

Vertical line

(0, 0) and (0, 5)
distance 5, slope undefined (vertical)

Frequently asked questions

What is the distance formula?

The distance between two points is the square root of the change in x squared plus the change in y squared. It comes straight from the Pythagorean theorem.

How is the midpoint found?

The midpoint is the average of the two x coordinates and the average of the two y coordinates, giving the exact center of the segment between the points.

Why is the slope sometimes undefined?

Slope is the change in y divided by the change in x. When both points share the same x, the change in x is zero and the line is vertical, so the slope is undefined.

Does the order of the points matter?

No. The distance, midpoint and slope are the same whichever point you call first, because squaring and averaging remove any difference in order.

Can I use negative or decimal coordinates?

Yes. Any finite numbers work, including negatives and decimals. Only infinite or non-numeric values are rejected.

Related tools