Part 5 of 10 · LinesSee the whole course

How to find the slope from two points

Short answer

To find the slope from two points, subtract the y-values, subtract the x-values in the same order, and divide: slope = (y₂ − y₁) ÷ (x₂ − x₁). It is “rise over run”: how far the line goes up for every step it goes across.

The slope formula, one step at a time

Take any two points on a line and call them (x₁, y₁) and (x₂, y₂). Then:

  1. Rise. Subtract the heights: y₂ − y₁. This is how far you go up (or down).
  2. Run. Subtract the x-values in the same order: x₂ − x₁. This is how far you go across.
  3. Divide. Slope = rise ÷ run.
slope = (y₂ − y₁) ÷ (x₂ − x₁)

Try it. Point A stays at (1, 2). Slide point B around and watch the rise, the run and the slope change.

slope = (8 − 2) ÷ (3 − 1) = 3
  1. rise = y₂ − y₁ = 8 − 2 = 6
  2. run = x₂ − x₁ = 3 − 1 = 2
  3. slope = rise ÷ run = 6 ÷ 2 = 3
The line goes up 3 for every 1 step across.
Aha!

Dividing the change in height by the change across between any two points gives you the slope.

Example 1: a line that goes up

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

Rise: 8 − 2 = 6
Run: 3 − 1 = 2
Slope: 6 ÷ 2 = 3

For every step across, the line goes up 3. That is the picture above, in its starting position.

Example 2: a line that goes down

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

Rise: 1 − 5 = −4
Run: 3 − (−1) = 4
Slope: −4 ÷ 4 = −1

A negative slope means the line goes downhill as you move to the right. Keep the minus sign, and keep the brackets: subtracting a negative number, as in 3 − (−1), is where most slips happen.

Does the order of the points matter?

No, as long as you use the same order on the top and the bottom. Swap the points from example 2:

Rise: 5 − 1 = 4
Run: −1 − 3 = −4
Slope: 4 ÷ (−4) = −1

The answer is the same. The mistake is mixing the orders: if the top is 1 − 5 = −4 but the bottom is −1 − 3 = −4, you get −4 ÷ −4 = +1. That has the wrong sign, because this line goes down.

Flat lines and straight-up lines

For example, the points (3, 2) and (3, 7) have the same x-value: the run is 3 − 3 = 0. They sit on a straight-up line, so there is no slope to find.

Watch it explained in under a minute

The same idea, narrated step by step. Square version for sharing: download the 1:1 video.

The five mistakes to avoid

Try it yourself

Find the slope through each pair of points. Tap a question to see the answer.

1. (2, 3) and (6, 11)

Rise: 11 − 3 = 8. Run: 6 − 2 = 4. Slope: 8 ÷ 4 = 2.

2. (0, 5) and (4, 1)

Rise: 1 − 5 = −4. Run: 4 − 0 = 4. Slope: −4 ÷ 4 = −1.

3. (3, 2) and (3, 7)

Run: 3 − 3 = 0, so the line is vertical and the slope is undefined.

Where slope fits in

Slope is one of the two numbers that describe any straight line. In y = mx + b, the number m is the slope and b is where the line starts on the y-axis (the Pip app writes a instead of m, which is the same thing). If slope is new to you, start with what slope is. Next in this course: slope-intercept form, explained. Our guide Learn algebra visually shows both numbers with a live graph you can drag.

Quick answers

Questions about this topic

What is the formula for the slope from two points?

Slope = (y₂ − y₁) ÷ (x₂ − x₁). Subtract the y-values for the rise, subtract the x-values in the same order for the run, and divide the rise by the run.

Does it matter which point I call the first one?

No. Swapping the two points changes the sign of both the rise and the run, so the slope comes out the same. Just use the same order on the top and the bottom.

Can a slope be negative or zero?

Yes. A line that goes downhill from left to right has a negative slope. A flat, horizontal line has a slope of 0.

What is the slope of a vertical line?

It is undefined. A vertical line has a run of 0, and dividing by 0 is not possible. A vertical line does not have slope 0.

Keep going

Learn it by playing

Pip: Math Adventure is a math game for iPhone where functions, lines, equations and calculus are puzzles you solve by playing. It is coming soon to the App Store.

Join the list and we will tell you the day Pip is out.