Home » Math Theory » Slope Formula

Note: this page contains legacy resources that are no longer supported. You are free to continue using these materials but we can only support our current worksheets, available as part of our membership offering.

Slope Formula

Quick answer

The slope formula finds the slope m of a line through two points (x₁, y₁) and (x₂, y₂): m = (y₂ − y₁) / (x₂ − x₁), the rise divided by the run. For (1, 2) and (4, 8), m = (8 − 2) / (4 − 1) = 6/3 = 2.

Reviewed by the Helping with Math Team · Updated 22 October 2026

What is the slope formula?

A straight line can be written as y = mx + b, where m is the slope of the line. There is more on this here. The slope formula lets you find m from any two points on the line.

The slope is the difference in the y-values divided by the difference in the x-values. This is often called the rise over the run.

m = (y₂ − y₁) / (x₂ − x₁)

  • Rise = y₂ − y₁ (the vertical change).
  • Run = x₂ − x₁ (the horizontal change).
  • Positive slope: the line goes up from left to right. Negative slope: it goes down.
  • Slope 0: a horizontal line. A vertical line has an undefined slope because the run is 0.

Examples using the formula

Example 1

Find the slope of the line through (1, 2) and (4, 8).

Solution

m = (8 − 2) / (4 − 1) = 6/3 = 2. The line rises 2 units for every 1 unit to the right.

Line through (1, 2) and (4, 8) with rise 6 and run 3(1, 2)(4, 8)run = 3rise = 6m = 6/3 = 2
From (1, 2) to (4, 8) the run is 3 and the rise is 6, so the slope is 6/3 = 2.

Example 2

Find the slope again, this time taking (4, 8) as the first point and (1, 2) as the second.

Solution

m = (2 − 8) / (1 − 4) = −6 / −3 = 2. It does not matter which point you call (x₁, y₁), as long as you use the same order on the top and the bottom.

Example 3

Find the slope of the line through (−2, 5) and (3, −5).

Solution

m = (−5 − 5) / (3 − (−2)) = −10/5 = −2. The slope is negative, so the line falls from left to right.

Example 4

Find the slope of the line through (2, 3) and (7, 3).

Solution

m = (3 − 3) / (7 − 2) = 0/5 = 0. The line is horizontal.

Example 5

Find the slope of the line through (5, 1) and (5, 6).

Solution

m = (6 − 1) / (5 − 5) = 5/0, which is undefined. The line is vertical.

Try it: slope explorer

Move the two points. The rise, run and slope update, and the triangle shows the rise over the run.

1245
Slope explorer with two movable points

rise = 5 − 2 = 3, run = 4 − 1 = 3, m = 1

Try it: the green point is (x₁, y₁) and the orange point is (x₂, y₂).

Common mistakes

  • Putting the x difference on top. Rise (y) goes on top, run (x) on the bottom.
  • Mixing the order: (y₂ − y₁) on top but (x₁ − x₂) on the bottom gives the wrong sign.
  • Forgetting that subtracting a negative means adding: 3 − (−2) = 5.

Worksheets

Use this worksheet for practice: Calculating the Slope of a Line, using m = (y₂ − y₁)/(x₂ − x₁) (2 pages).

Check yourself: the slope formula
4 quick questions. Tap an answer to see if you are right.

  1. Slope through (0, 1) and (2, 7)?

  2. Slope through (1, 5) and (3, 1)?

  3. Slope through (4, 2) and (9, 2)?

  4. Slope through (3, 1) and (3, 8)?

Answered 0 of 4.

Each answer shows a short explanation. Press Try again to reset the quiz.

Slope Formula FAQs

What is the slope formula?

m = (y₂ − y₁) / (x₂ − x₁): the change in y divided by the change in x between two points.

Does it matter which point is first?

No, as long as you subtract in the same order on the top and the bottom.

What does a negative slope mean?

The line goes down from left to right.

What is the slope of a horizontal line?

0, because the rise is 0.

Why is the slope of a vertical line undefined?

The run is 0, and you cannot divide by 0.

Practice with worksheets