Skip to content
SnapCalculations

How to Find the Slope of a Line (Formula, Steps & Examples)

By the SnapCalculations team · Updated 2 Nov 2026

The short answer

Slope = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x, often called rise over run. Subtract the y-values, subtract the x-values in the same order, then divide.

What slope means

Slope tells you how steep a line is and which way it goes. It's the number of units the line goes up (or down) for every one unit you move to the right. In the UK it's usually called the gradient; it means exactly the same thing.

  • Positive slope: the line goes up from left to right.
  • Negative slope: the line goes down from left to right.
  • Zero slope: the line is flat (horizontal).
  • Undefined slope: the line goes straight up and down (vertical).

The bigger the number (ignoring the sign), the steeper the line. A slope of 3 is steeper than a slope of 1/2.

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

m is the slope; (x₁, y₁) and (x₂, y₂) are any two points on the line

How to find the slope from two points

  1. 1Label your points. Call one (x₁, y₁) and the other (x₂, y₂). It doesn't matter which is which.
  2. 2Find the rise: subtract the y-values, y₂ − y₁.
  3. 3Find the run: subtract the x-values in the same order, x₂ − x₁.
  4. 4Divide rise by run, and simplify the fraction if you can.

Keep the order the same on top and bottom. If you start with the second point's y, start with the second point's x too. Mixing the order flips the sign and gives the wrong answer.

Worked examples

Example 1: a rising line

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

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

Answer: m = 2: the line rises 2 units for every 1 unit to the right

Try it in the calculator

Example 2: negative numbers and a fraction

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

  1. Rise = −2 − 4 = −6.
  2. Run = 3 − (−1) = 3 + 1 = 4.
  3. Slope = −6 ÷ 4 = −3/2.

Answer: m = −3/2 (or −1.5): the line falls as it goes right

Try it in the calculator

Example 3: flat and vertical lines

What are the slopes of the line through (1, 3) and (5, 3), and the line through (2, 1) and (2, 5)?

  1. First line: rise = 3 − 3 = 0, run = 5 − 1 = 4, so slope = 0 ÷ 4 = 0. It's horizontal.
  2. Second line: rise = 5 − 1 = 4, run = 2 − 2 = 0. You can't divide by zero, so the slope is undefined. It's vertical.

Answer: 0 for the horizontal line; undefined for the vertical line

Try it in the calculator

Example 4: how steep is a road?

A road climbs 15 m over a horizontal distance of 300 m. What is its gradient?

  1. Rise = 15, run = 300.
  2. Slope = 15 ÷ 300 = 0.05.
  3. As a percentage: 0.05 × 100 = 5%, the number you'd see on a road sign.

Answer: A gradient of 0.05, or 5% (an angle of about 2.86°)

Try it in the calculator

Finding the slope from a graph

  1. 1Pick two points where the line crosses the grid exactly, so you can read them accurately.
  2. 2Count how many squares you go up (or down) to get from the left point to the right point. That's the rise; going down makes it negative.
  3. 3Count how many squares you go across. That's the run.
  4. 4Divide rise by run, checking the scale on each axis in case the squares aren't worth 1.

Finding the slope from an equation

If the equation is written as y = mx + b, the slope is simply the number in front of x. In y = 4x − 7, the slope is 4. If it's written another way, rearrange it so y is on its own first.

Example 5: rearrange to find the slope

What is the slope of 2x + 3y = 6?

  1. Subtract 2x from both sides: 3y = −2x + 6.
  2. Divide everything by 3: y = −(2/3)x + 2.
  3. The number in front of x is −2/3.

Answer: m = −2/3, and the line crosses the y-axis at 2

Try it in the calculator

Common mistakes to avoid

  • Putting x on top. Slope is the change in y divided by the change in x, never the other way round.
  • Mixing the subtraction order between top and bottom, which flips the sign.
  • Dropping negative signs. Subtracting a negative means adding: 3 − (−1) = 4.
  • Calling a vertical line's slope zero. Zero is a flat line; a vertical line's slope is undefined.

Check your answer instantly

Enter any two points into our slope calculator to see the slope as a fraction and a decimal, the equation of the line, the distance and midpoint between the points, and the angle, with each step shown.

Free, with every step shownOpen the Slope Calculator

Frequently asked questions

Is slope the same as gradient?

Yes. “Gradient” is the usual word in the UK, and “slope” is more common in the US. Both mean rise over run.

Can the slope be a fraction?

Yes, and it often is. A slope of 2/3 means the line rises 2 units for every 3 units across. Leave it as a fraction unless you're asked for a decimal.

How do I turn a slope into an angle?

Use the inverse tangent: angle = tan⁻¹(slope). A slope of 1 is 45°, and a slope of 0.05 is about 2.86°.

What does a slope of 0 mean in real life?

Nothing is changing. On a distance–time graph, for example, a flat line means the object isn't moving.