How to find the slope of a line
The slope of a line is how much y changes when x increases by 1. You can read it from two points, a graph, an equation or a table, and all four give the same number. Divide the change in y (the rise) by the change in x (the run).
Method 1. From two points
m = (y₂ − y₁) ÷ (x₂ − x₁)
For (2, 3) and (6, 11), the rise is 11 − 3 = 8 and the run is 6 − 2 = 4, so m = 8 ÷ 4 = 2. The slope calculator does this and also gives the angle and percent grade.
Method 2. From a graph
Pick two points where the line crosses grid corners. Count the squares up (rise) and across to the right (run) from the first to the second. Going down counts as a negative rise. Always move left to right so the run is positive, which keeps the sign of the slope honest.
Method 3. From an equation
Rewrite the equation as y = mx + b. The coefficient of x is the slope and b is where the line crosses the y-axis. For 3x + 2y = 12, subtract 3x from both sides and divide by 2 to get y = −1.5x + 6, so the slope is −1.5. An equation already in point-slope form, y − 3 = 2(x − 2), shows its slope of 2 directly.
Method 4. From a table
| x | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| y | 5 | 8 | 11 | 14 |
Take any two columns. From x = 1 to x = 2, y goes from 5 to 8, so m = 3 ÷ 1 = 3. Check a second pair, x = 2 to x = 4, which gives 6 ÷ 2 = 3. If different pairs give different slopes, the table is not a straight line and has no single slope.
What the sign of the slope tells you
| Slope | The line | Example |
|---|---|---|
| Positive | Rises left to right | y = 2x − 1 |
| Negative | Falls left to right | y = −1.5x + 6 |
| Zero | Horizontal | y = 4 |
| Undefined | Vertical | x = 3 |
The bigger the absolute value, the steeper the line. Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line with slope 2 is perpendicular to one with slope −½.
Common mistakes
- Subtracting in a different order on top and bottom, which flips the sign.
- Putting run over rise. It is rise over run, y over x.
- Reading slope from an equation that is not solved for y. In 3x + 2y = 12 the slope is not 3.
- Calling a vertical line's slope zero. Zero is horizontal; vertical is undefined.
If you want the slope of a best-fit line through scattered data instead of two exact points, use the linear regression calculator.
Related calculators
-
Slope calculator
Slope, angle, percent grade and the line equation from two points.
-
Linear equation calculator
Solve and rewrite equations in slope-intercept form.
-
Distance and midpoint calculator
The other two questions you can ask about two points.
Common questions
What is the slope formula?
m = (y₂ − y₁) ÷ (x₂ − x₁), the change in y divided by the change in x between any two points on the line.
How do you find the slope from an equation?
Solve for y. In y = mx + b the number multiplying x is the slope. For 3x + 2y = 12 that gives y = −1.5x + 6, so the slope is −1.5.
What is the slope of a horizontal or vertical line?
A horizontal line has slope 0, because y never changes. A vertical line has an undefined slope, because x never changes and the formula divides by zero.
Does it matter which point I call point 1?
No, as long as you subtract in the same order on top and bottom. Swapping the points flips the sign of both differences, and the signs cancel.