Slope Formula: How to Find the Slope of a Line (m = rise ÷ run)
The slope of a line tells you how steep it is and which way it goes. It’s the vertical change (rise) divided by the horizontal change (run) between any two points on the line.
Quick answer
m = (y₂ − y₁) ÷ (x₂ − x₁)
Example: from (1, 2) to (3, 8), m = (8 − 2) ÷ (3 − 1) = 6 ÷ 2 = 3.
Step by step
Find the slope through (−2, 5) and (4, −1):
- First, subtract the y-values: −1 − 5 = −6 (the rise).
- Then subtract the x-values in the same order: 4 − (−2) = 6 (the run).
- Finally, divide: −6 ÷ 6 = −1.
Keep the order consistent: if you start with point 2’s y, start with point 2’s x too.
The four kinds of slope
| Slope | Line goes | Example |
|---|---|---|
| Positive | Up from left to right | m = 3 |
| Negative | Down from left to right | m = −1 |
| Zero | Flat (horizontal) | (1, 4) to (5, 4) |
| Undefined | Straight up (vertical) | (2, 1) to (2, 7): divides by zero |
Slope-intercept form: y = mx + b
Once you know the slope, you can write the line’s equation. m is the slope and b is where the line crosses the y-axis. For slope 3 through (1, 2): 2 = 3 × 1 + b, so b = −1 and the line is y = 3x − 1.
Slope in real life
- Ramps and roads: a slope of 1/12 rises 1 inch for every 12 inches of length. As a percentage grade, that’s about 8.3%; see how to calculate a percentage.
- Roofs: pitch is written as rise per 12 units of run, such as 6/12.
- Rates: on a graph of distance over time, the slope is the speed.
Related: the distance formula and midpoint formula use the same two points.
Frequently asked questions
What is the slope formula?
m = (y₂ − y₁) ÷ (x₂ − x₁).
What does a negative slope mean?
The line goes down from left to right.
What is the slope of a horizontal line?
Zero.
Why is a vertical line’s slope undefined?
The run is zero, and you can’t divide by zero.
