House of Calculator

Enter two points and get the straight-line distance, the midpoint, the slope and the equation of the line through them.

Results are estimates for planning. Check the figures before you make a financial or health decision.

Embed this calculator on your website

Free to use. Copy the code and paste it into your page. Please keep the link under the calculator in place: it is how we keep the tool free.

The distance formula

The distance between (x₁, y₁) and (x₂, y₂) comes from the Pythagorean theorem:

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

The midpoint is the average of the coordinates: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). The slope is (y₂ − y₁) ÷ (x₂ − x₁).

Worked example

Points (1, 2) and (7, 10).

MeasureWorkingResult
Change in x and y7 − 1, 10 − 26, 8
Distance√(6² + 8²) = √10010
Midpoint(8 ÷ 2, 12 ÷ 2)(4, 6)
Slope8 ÷ 61.3333

Tips and common mistakes

It does not matter which point you call first: squaring removes the sign of the differences.

This is the straight-line distance on a flat grid. It is not a map distance between two places on the Earth, which needs latitude and longitude.

Two points with the same x give a vertical line with an undefined slope.

Frequently asked questions

How do I find the distance between two points?

Square the difference in x and the difference in y, add them, and take the square root.

How do I find the midpoint?

Average the x values and average the y values.

Does it work in 3D?

This calculator is for two dimensions. In 3D you add (z₂ − z₁)² under the square root.

Is this the same as the Pythagorean theorem?

Yes. The two differences are the legs of a right triangle and the distance is the hypotenuse.

Related calculators