How-to guides · 5 min read
How to Find the Slope of a Line: Formula and Examples

What slope means
The slope of a line tells you how much y changes when x increases by one. A larger slope means a steeper line. A positive slope rises from left to right, a negative slope falls, a horizontal line has slope 0 and a vertical line has no defined slope. Slope is written with the letter m.
In everyday terms, slope is a rate of change: dollars per hour, kilometres per litre or metres climbed per metre travelled. That is why it appears in algebra, physics, economics and road design. The idea is the same in each: change in the vertical quantity divided by change in the horizontal quantity.
The slope formula
For two points (x₁, y₁) and (x₂, y₂) on a line, m = (y₂ − y₁) ÷ (x₂ − x₁). The top is the rise and the bottom is the run. It does not matter which point you call the first, as long as you subtract in the same order on top and bottom.
Slope through (1, 2) and (5, 10)
Order-of-operations steps 3 steps
Start: (10 − 2) ÷ (5 − 1)
- Subtract
10 − 2 = 8→ 8 ÷ (5 − 1) - Subtract
5 − 1 = 4→ 8 ÷ 4 - Divide
8 ÷ 4 = 2→ 2
The rise is 10 − 2 = 8 and the run is 5 − 1 = 4, so m = 8 ÷ 4 = 2. Swap the points and you get (2 − 10) ÷ (1 − 5) = −8 ÷ −4 = 2, the same answer.
Worked examples with different signs
| Point 1 | Point 2 | Rise ÷ run | Slope | Type |
|---|---|---|---|---|
| (2, 3) | (6, 11) | 8 ÷ 4 | 2 | positive |
| (0, 5) | (4, 1) | −4 ÷ 4 | −1 | negative |
| (1, 1) | (4, 3) | 2 ÷ 3 | 2/3 | positive (fraction) |
| (−2, 4) | (5, 4) | 0 ÷ 7 | 0 | zero |
| (3, 2) | (3, 7) | 5 ÷ 0 | undefined | undefined |
A zero run, as in the last row, means dividing by zero, so the slope is undefined: the line is vertical. A zero rise gives slope 0, a horizontal line.
Slope-intercept form: y = mx + b
Once you know the slope, the equation of the line is y = mx + b, where b is the y-intercept, the value of y when x = 0. To find b, substitute one known point. For the line through (1, 2) with slope 2: 2 = 2(1) + b, so b = 0 and the line is y = 2x.
For the line through (0, 5) and (4, 1), the slope is −1 and the point (0, 5) gives the intercept directly, so y = −x + 5. Check the other point: −4 + 5 = 1 ✓.
You can draw any line from its equation this way: plot the intercept, then use the rise and run to find a second point. The function grapher will draw it to check.
Finding slope from an equation
If the equation is already in the form y = mx + b, the slope is the number multiplying x. If it is in standard form Ax + By = C, rearrange for y: By = −Ax + C, so y = (−A/B)x + C/B, and the slope is −A/B.
| Equation | Rearranged | Slope | y-intercept |
|---|---|---|---|
| y = 3x − 4 | already in form | 3 | −4 |
| 3x + 2y = 12 | y = −(3/2)x + 6 | −3/2 | 6 |
| x − 4y = 8 | y = (1/4)x − 2 | 1/4 | −2 |
| 2x + 5y = 10 | y = −(2/5)x + 2 | −2/5 | 2 |
To work through the rearranging itself, see how to solve linear equations step by step, since the same inverse operations apply.
Parallel and perpendicular lines
Parallel lines never meet, so they have the same slope. Perpendicular lines meet at a right angle, and their slopes are negative reciprocals: multiply them and you get −1.
| Slope of line 1 | Parallel slope | Perpendicular slope | Product with perpendicular |
|---|---|---|---|
| 2 | 2 | −1/2 | −1 |
| −3 | −3 | 1/3 | −1 |
| 1/2 | 1/2 | −2 | −1 |
| −2/3 | −2/3 | 3/2 | −1 |
Example: a line perpendicular to y = 2x + 1 has slope −1/2, so through the point (4, 3) it is y − 3 = −(1/2)(x − 4), which simplifies to y = −(1/2)x + 5.
Slope in real situations
A road that rises 6 metres over a horizontal distance of 100 metres has slope 6 ÷ 100 = 0.06, usually called a 6% grade. Accessible ramps in many places are limited to about 1 unit of rise per 12 units of run, a slope of 1/12 (about 8.3%); check the rules for your location. If a taxi charges 3.00 plus 2.00 per kilometre, the slope of the cost line is 2.00 per kilometre.
In every case, the slope is the rate: how much the vertical quantity changes per one unit of the horizontal quantity.
Common mistakes
- Mixing the order. Rise ÷ run must use the same point order on top and bottom. (y₂ − y₁) ÷ (x₁ − x₂) gives the wrong sign.
- Putting run over rise. Slope is vertical change over horizontal change, not the other way round.
- Calling a vertical line slope 0. Vertical lines are undefined; horizontal lines are 0.
- Reading b as the slope. In y = mx + b, m is the slope and b is the intercept.
More habits to avoid are in common algebra mistakes, and the algebra formulas cheat sheet lists slope, point-slope and standard form together. You can also check lines with the linear equation solver.
Frequently asked questions
What is the slope formula?
m = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x between two points.
Why is the slope of a vertical line undefined?
Every point on it has the same x, so the run is 0 and the formula divides by zero.
How do I find the slope from a graph?
Pick two clear points on the line, count the rise and run between them, and divide rise by run.
What is the slope of a line perpendicular to one with slope 3?
The negative reciprocal, −1/3, because 3 × (−1/3) = −1.
Keep reading
How to Solve Linear Equations Step by Step (With Examples)
Learn to solve linear equations in x with a repeatable method: undo operations, balance both sides, handle brackets, fractions and special cases.
How-to guidesHow to Solve Systems of Equations Step by Step
Solve two equations in two unknowns by substitution, elimination and graphing, with worked examples, special cases and a word problem.
Charts & referencesAlgebra Formulas Cheat Sheet: Identities, Exponents, Quadratics
The algebra formulas you need most: special products, exponent and log rules, the quadratic formula, slope and distance, with a worked check.
How-to guidesHow to Solve Inequalities Step by Step (With Examples)
Solve inequalities like 3x + 5 > 20 using the same steps as equations, plus one new rule: flip the sign when you multiply or divide by a negative.