Home / Guides / How to Find the Slope of a Line

How to Find the Slope of a Line

Slope tells you how steep a line is and which way it goes. This guide shows you the formula, works through examples step by step, and explains how slope connects to line equations, angles and percent grade.

By Dr. Muhammad Amjad Khadim, PhD (Mathematics) · Published · How we check our content

Want the answer straight away?Open the Slope Calculator →

What slope means

The slope of a line, usually written m, is the change in y for every 1-unit change in x. It is often described as rise over run: how far the line goes up (or down) divided by how far it goes across. A slope of 3 means the line rises 3 units for each unit you move to the right.

The slope formula

For two points (x₁, y₁) and (x₂, y₂) on a line:

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

The top is the rise (change in y) and the bottom is the run (change in x). It doesn't matter which point you call “1” and which “2”, as long as you keep the same order on top and bottom.

Worked examples

Example 1: points (1, 2) and (4, 8)

  1. Rise: y₂ − y₁ = 8 − 2 = 6
  2. Run: x₂ − x₁ = 4 − 1 = 3
  3. Slope: m = 6 ÷ 3 = 2

The line rises 2 units for every 1 unit across.

Example 2: points (−2, 5) and (3, −5)

  1. Rise: −5 − 5 = −10
  2. Run: 3 − (−2) = 5
  3. Slope: m = −10 ÷ 5 = −2

The negative sign means the line falls as you move right. Watch the double negative in the run: subtracting −2 is the same as adding 2.

Example 3: a fractional slope, (0, 1) and (6, 5)

m = (5 − 1) ÷ (6 − 0) = 4 ÷ 6 = 2/3. Keep fractions in simplest form rather than rounding to a decimal; 2/3 tells you exactly “up 2, across 3”.

The four types of slope

TypeValue of mWhat the line does
Positivem > 0Rises from left to right
Negativem < 0Falls from left to right
Zerom = 0Horizontal (y stays the same)
Undefinedrun = 0Vertical (x stays the same); you can't divide by zero

From slope to the equation y = mx + b

Once you know the slope, you can write the equation of the line in slope-intercept form, y = mx + b, where b is the y-intercept (where the line crosses the y-axis).

  1. Use Example 1: m = 2, and the point (1, 2).
  2. Substitute into y = mx + b: 2 = 2 × 1 + b.
  3. Solve: b = 0.
  4. Equation: y = 2x.

You can also use point-slope form, y − y₁ = m(x − x₁), which skips straight to an equation from any one point and the slope.

Slope as an angle or percent grade

Roads, ramps and roofs often describe steepness differently:

A 100% grade is a 45° angle, not a vertical wall, which surprises many people.

Parallel and perpendicular lines

Common mistakes

Try it with your own numbers.Use the free Slope Calculator →

Frequently asked questions

What is the formula for slope?

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

What does a slope of 0 mean?

The line is horizontal. Its y value never changes.

What is an undefined slope?

A vertical line has an undefined slope, because the run (change in x) is zero and you cannot divide by zero.

How do I turn slope into an angle?

Take the arctangent of the slope. A slope of 1 gives 45°.

What is the slope of a perpendicular line?

The negative reciprocal. If one line has slope 3/4, a perpendicular line has slope −4/3.

About the author

Dr. Muhammad Amjad Khadim holds a PhD in Mathematics and writes and checks the formulas behind Adzita's calculators and guides. Google Scholar profile.

More guides

Roman Numerals: Chart, Rules and How to ConvertLearn to read and write Roman numerals with a 1–100 chart, years like 2026 (MMXXVI), the six subtractive…How to Add and Subtract Time in Hours and MinutesAdd and subtract hours and minutes the easy way, convert minutes to decimal hours for timesheets, and handle…How to Count the Days Between Two DatesCount the days between two dates by hand, in Excel or Google Sheets. Learn when to include the end date, how…How Much Paint Do I Need for a Room?Work out how much paint you need in gallons or liters: measure walls, subtract doors and windows, allow for…