Slope Calculator
Enter two points and get the slope (rise over run), the full line equation y = mx + b, the distance between the points and the incline angle. Vertical lines are called out as undefined slope rather than an error you have to puzzle over.
Slope formula
Slope measures steepness: how much y changes per unit of x. Subtract the coordinates in the same order — rise = y₂ − y₁, run = x₂ − x₁ — and divide. Positive slopes go up left-to-right, negative go down, 0 is flat, and a vertical line has no defined slope (the run is 0).
From the slope, the y-intercept follows from either point (b = y − mx), the distance comes from the Pythagorean theorem on rise and run, and the angle is arctan of the slope — the same math behind roof pitch and road grade.
Worked examples
Example 1: slope through (1, 2) and (5, 10)
Find the slope and equation.
- Rise and run.rise = 10 − 2 = 8; run = 5 − 1 = 4
- Divide.m = 8 ÷ 4 = 2
- Intercept from point (1, 2).b = 2 − 2 × 1 = 0 → y = 2x
Slope 2, line y = 2x.
Example 2: a downhill line
Points (0, 5) and (10, 1).
- Rise and run in the same order.rise = 1 − 5 = −4; run = 10 − 0 = 10
- Divide — the negative rise makes a negative slope.−4 ÷ 10 = −0.4
Slope −0.4 — the line falls 0.4 units per unit right; as a road grade that's −40%.
Example 3: roof pitch to angle
A roof rises 6 inches per 12 inches of run (a "6/12 pitch"). What's the angle?
- Slope from pitch.6 ÷ 12 = 0.5
- Angle is arctangent of the slope.atan(0.5) ≈ 26.6°
About 26.6 degrees.
FAQ
Does the order of the points matter?+
No — swapping both points flips the signs of rise and run, and the minus signs cancel. Just subtract in the same order on top and bottom.
What's the slope of a vertical line?+
Undefined — the run is 0 and you can't divide by zero. Its equation is x = constant. (A horizontal line is slope 0; "zero" and "undefined" are different answers.)
How do slope and grade (%) relate?+
Grade is slope × 100: a 0.06 slope is a 6% grade. Highways flag grades above about 6%; wheelchair ramps per ADA max out at 1:12 ≈ 8.3%.
How do I find a line parallel or perpendicular to this one?+
Parallel lines share the slope m; perpendicular lines have slope −1/m (the negative reciprocal). A perpendicular to y = 2x has slope −0.5.
Related calculators
- Pythagorean CalculatorSolve a² + b² = c² for the hypotenuse or a missing leg of a right triangle, with the squaring and square-root steps shown.
- Quadratic Formula CalculatorSolve ax² + bx + c = 0 with the quadratic formula: discriminant, both roots (real or complex) and the vertex — every step shown.