Slope Calculator
Find the slope, y-intercept and line equation y = mx + b through two points.
How it works
m = (y₂ − y₁) ÷ (x₂ − x₁) · b = y₁ − m × x₁
Slope is rise over run: how much y changes per unit of x. Once m is known, plugging either point into y = mx + b and solving gives the y-intercept — where the line crosses the y-axis. A horizontal line has slope 0; a vertical line has no defined slope at all, because its run is zero.
Worked example
Through (1, 2) and (5, 10): m = (10 − 2) ÷ (5 − 1) = 8 ÷ 4 = 2. Then b = 2 − 2 × 1 = 0, so the line is y = 2x, climbing 2 units for every 1 unit right.
Frequently asked questions
What does a negative slope mean?
The line falls as you move right: y decreases while x increases. A slope of −3 drops 3 units for every unit right — steepness is the size of the number, direction is its sign.
How does slope relate to grade or pitch?
A road grade is slope as a percent: slope 0.08 is an 8% grade. Roof pitch is rise per 12 of run, so a 6/12 pitch is a slope of 0.5.
How do I find a line parallel or perpendicular to this one?
Parallel lines share the same slope m. Perpendicular lines have the negative reciprocal: perpendicular to slope 2 is slope −½.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.