Slope formula
Example: through (1, 2) and (4, 8), the rise is 6 and the run is 3, so the slope is 2. Then b = 2 − 2 × 1 = 0, so the line is y = 2x. The points are √(9 + 36) = 6.7082 apart, the midpoint is (2.5, 5), and the line climbs at 63.43°.
Reading a slope
- Positive: the line rises from left to right. Negative: it falls.
- Zero: a horizontal line, y = b. Undefined: a vertical line, x = a, because the run is zero.
- Parallel lines have the same slope. Perpendicular lines have slopes that multiply to −1, like 2 and −½.
In roads and ramps, slope is usually given as a grade: a 5% grade rises 5 feet per 100 feet. For roof slopes, see the roofing calculator.
Frequently asked questions
How do you find the slope from two points?
Subtract the y-values and divide by the difference of the x-values, in the same order: m = (y₂ − y₁) ÷ (x₂ − x₁).
What is an undefined slope?
A vertical line has an undefined slope, because the run (change in x) is zero and you can't divide by zero.
How do I find the y-intercept?
Once you have the slope, plug either point into y = mx + b and solve for b: b = y₁ − m × x₁.
Was this calculator helpful?