Account

What new tool do you want?

Math & Education

Slope, Distance & Midpoint Calculator

Find the slope, line equation (y = mx + b), distance, midpoint and angle between two points on a coordinate plane.

How to use

  1. 1Enter the coordinates of two points (x₁, y₁) and (x₂, y₂).
  2. 2Read the slope, equation, distance and midpoint.

How it's calculated

Slope m = (y₂ − y₁) ÷ (x₂ − x₁). b = y₁ − m x₁. Distance = √((x₂ − x₁)² + (y₂ − y₁)²). Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2).

Frequently asked questions

What does a negative slope mean?

The line goes down from left to right.

What is the slope of a vertical line?

Undefined — the run is zero. Its equation is x = constant.

How do I convert slope to an angle or grade?

Angle = arctan(slope). A slope of 0.05 is a 5% grade, about 2.86°.

Why 'undefined' isn't the same as 'zero'

Slope is rise over run — (y₂ − y₁) ÷ (x₂ − x₁) — and when both points share the same x-coordinate, the run is zero, making the division undefined rather than equal to zero. A horizontal line (zero rise, nonzero run) has a real slope of exactly 0; a vertical line (nonzero rise, zero run) has no slope at all, because you can't express 'straight up' as a ratio of vertical to horizontal change. That distinction is also why a vertical line's equation is written as x = constant rather than in y = mx + b form — b and m themselves aren't defined for it.

Worked example: Slope, Distance & Midpoint Calculator

Points (1, 2) and (4, 8) give a slope of (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2, a line equation of y = 2x + 0, a distance of √(3² + 6²) = √45 ≈ 6.708, and a midpoint of (2.5, 5) — simply averaging each coordinate separately. The angle to the x-axis, arctan(6 ÷ 3) ≈ 63.43°, is a different number from the slope itself (2) precisely because slope is a ratio while the angle is what that ratio corresponds to on a protractor — a slope of 1 is a 45° angle, but a slope of 2 is not a 90° angle, since arctan isn't linear.

Slope as a percentage grade

Road signs and ramps describe steepness as a percentage grade, which is just the slope expressed as a percentage rather than a decimal — a slope of 0.05 is a 5% grade. Converting that to the angle you'd actually measure with a protractor requires the arctan function, not simple multiplication: arctan(0.05) ≈ 2.86°, noticeably less than 5° even though a 5% grade sounds like it should correspond to a 5° slope.

Why the equation's sign flips instead of showing a negative plus

When the y-intercept works out negative, the calculator doesn't print something awkward like 'y = 2x + −3' — it switches the operator to a minus sign and shows the absolute value instead, producing 'y = 2x − 3'. That's purely a display convenience: the underlying value of b is unchanged, and plugging x = 0 into either written form gives the same y-intercept. It's a small detail, but it's exactly the kind of formatting a line-equation calculator needs to get right, since a double-sign expression reads as a typo even though it would still be mathematically valid.

Related tools

More: Math & Education