How-to guides · 5 min read

How to Find the Slope of a Line: Formula and Examples

How to Find the Slope of a Line: Formula and Examples — illustration
In short: Slope measures how steep a line is: rise ÷ run, or (y₂ − y₁) ÷ (x₂ − x₁). For the points (1, 2) and (5, 10) the slope is 2, so the line goes up 2 for every 1 step right.

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)
Answer2
Order-of-operations steps 3 steps

Start: (10 − 2) ÷ (5 − 1)

  1. Subtract
    10 − 2 = 8→ 8 ÷ (5 − 1)
  2. Subtract
    5 − 1 = 4→ 8 ÷ 4
  3. 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 1Point 2Rise ÷ runSlopeType
(2, 3)(6, 11)8 ÷ 42positive
(0, 5)(4, 1)−4 ÷ 4−1negative
(1, 1)(4, 3)2 ÷ 32/3positive (fraction)
(−2, 4)(5, 4)0 ÷ 70zero
(3, 2)(3, 7)5 ÷ 0undefinedundefined

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 ✓.

013450123456y = (2/3)x + 1x
y = (2/3)x + 1: from any point, go up 2 and right 3 to reach the next point on the line.

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.

EquationRearrangedSlopey-intercept
y = 3x − 4already in form3−4
3x + 2y = 12y = −(3/2)x + 6−3/26
x − 4y = 8y = (1/4)x − 21/4−2
2x + 5y = 10y = −(2/5)x + 2−2/52

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 1Parallel slopePerpendicular slopeProduct with perpendicular
22−1/2−1
−3−31/3−1
1/21/2−2−1
−2/3−2/33/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.

Written and reviewed by Mateuss M.

Mateuss M. writes and reviews mathematical content for CalcSolver, focusing on online calculators, formulas, equations, and practical math tools. He reviews calculator functionality, calculation methods, formulas, examples, and explanations to help ensure that each tool is clear, useful, and easy to understand.

Keep reading