Slope Calculator
Slope between two points, as a fraction and decimal, plus the line equation y = mx + b.
Find the slope of the line through two points as an exact fraction and a decimal, along with the y-intercept, the slope-intercept equation y = mx + b, the angle of the line and the distance between the points.
The slope formula
m = (y₂ − y₁) ÷ (x₂ − x₁)
Slope measures steepness: how much the line rises (or falls) for each step to the right. It's often described as "rise over run."
Worked example
For the points (2, 3) and (5, 1):
- Rise = 1 − 3 = −2, run = 5 − 2 = 3, so the slope is m = −2/3 ≈ −0.6667.
- The y-intercept is b = y₁ − m·x₁ = 3 − (−2/3)(2) = 3 + 4/3 = 13/3.
- The line is y = (−2/3)x + 13/3.
- The distance between the points is √(3² + (−2)²) = √13 ≈ 3.6056.
Reading the slope
| Slope | The line… |
|---|---|
| Positive (m > 0) | rises from left to right |
| Negative (m < 0) | falls from left to right |
| Zero (m = 0) | is horizontal: y = b |
| Undefined | is vertical: x = a |
The angle shown is the angle between the line and the positive x-axis, found with arctan(m). A slope of 1 is a 45° line.
Frequently asked questions
What is the slope formula?
Slope m = (y₂ − y₁) ÷ (x₂ − x₁): the change in y (the rise) divided by the change in x (the run) between two points on the line.
What does a negative slope mean?
The line goes down as you move from left to right. A positive slope goes up, a slope of 0 is a flat (horizontal) line, and a vertical line has an undefined slope.
Why is the slope of a vertical line undefined?
On a vertical line both points have the same x-value, so the run (x₂ − x₁) is zero, and dividing by zero is undefined. Its equation is written as x = a constant instead of y = mx + b.
What is slope-intercept form?
It is the line equation y = mx + b, where m is the slope and b is the y-intercept — the y-value where the line crosses the y-axis (where x = 0).
Does it matter which point I call point 1?
No. Swapping the points flips the signs of both the rise and the run, so their ratio — the slope — stays the same.