How to Find the Slope of a Line
Slope tells you how steep a line is and which way it goes. This guide shows you the formula, works through examples step by step, and explains how slope connects to line equations, angles and percent grade.
What slope means
The slope of a line, usually written m, is the change in y for every 1-unit change in x. It is often described as rise over run: how far the line goes up (or down) divided by how far it goes across. A slope of 3 means the line rises 3 units for each unit you move to the right.
The slope formula
For two points (x₁, y₁) and (x₂, y₂) on a line:
m = (y₂ − y₁) ÷ (x₂ − x₁)
The top is the rise (change in y) and the bottom is the run (change in x). It doesn't matter which point you call “1” and which “2”, as long as you keep the same order on top and bottom.
Worked examples
Example 1: points (1, 2) and (4, 8)
- Rise: y₂ − y₁ = 8 − 2 = 6
- Run: x₂ − x₁ = 4 − 1 = 3
- Slope: m = 6 ÷ 3 = 2
The line rises 2 units for every 1 unit across.
Example 2: points (−2, 5) and (3, −5)
- Rise: −5 − 5 = −10
- Run: 3 − (−2) = 5
- Slope: m = −10 ÷ 5 = −2
The negative sign means the line falls as you move right. Watch the double negative in the run: subtracting −2 is the same as adding 2.
Example 3: a fractional slope, (0, 1) and (6, 5)
m = (5 − 1) ÷ (6 − 0) = 4 ÷ 6 = 2/3. Keep fractions in simplest form rather than rounding to a decimal; 2/3 tells you exactly “up 2, across 3”.
The four types of slope
| Type | Value of m | What the line does |
|---|---|---|
| Positive | m > 0 | Rises from left to right |
| Negative | m < 0 | Falls from left to right |
| Zero | m = 0 | Horizontal (y stays the same) |
| Undefined | run = 0 | Vertical (x stays the same); you can't divide by zero |
From slope to the equation y = mx + b
Once you know the slope, you can write the equation of the line in slope-intercept form, y = mx + b, where b is the y-intercept (where the line crosses the y-axis).
- Use Example 1: m = 2, and the point (1, 2).
- Substitute into y = mx + b: 2 = 2 × 1 + b.
- Solve: b = 0.
- Equation: y = 2x.
You can also use point-slope form, y − y₁ = m(x − x₁), which skips straight to an equation from any one point and the slope.
Slope as an angle or percent grade
Roads, ramps and roofs often describe steepness differently:
- Percent grade = slope × 100. A slope of 0.05 is a 5% grade: 5 feet up for every 100 feet across.
- Angle = arctan(slope). A slope of 1 is 45°, a slope of 2 is about 63.4°, and a 5% grade is only about 2.9°.
A 100% grade is a 45° angle, not a vertical wall, which surprises many people.
Parallel and perpendicular lines
- Parallel lines have the same slope. y = 2x + 1 and y = 2x − 7 never meet.
- Perpendicular lines have slopes that are negative reciprocals: flip the fraction and change the sign. A line perpendicular to slope 2 has slope −1/2. Multiplied together, the two slopes give −1.
Common mistakes
- Mixing the order. If you do y₂ − y₁ on top, you must do x₂ − x₁ on the bottom, not x₁ − x₂.
- Putting x on top. Slope is change in y over change in x, never the other way round.
- Losing negative signs. Use brackets when subtracting a negative coordinate.
- Calling a vertical line's slope zero. Horizontal lines have zero slope; vertical lines have undefined slope.
Frequently asked questions
What is the formula for slope?
m = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x between two points.
What does a slope of 0 mean?
The line is horizontal. Its y value never changes.
What is an undefined slope?
A vertical line has an undefined slope, because the run (change in x) is zero and you cannot divide by zero.
How do I turn slope into an angle?
Take the arctangent of the slope. A slope of 1 gives 45°.
What is the slope of a perpendicular line?
The negative reciprocal. If one line has slope 3/4, a perpendicular line has slope −4/3.