MathIt Blog

How to find the slope of a line from two points, a graph or an equation

By Laura Bennett, MathIt · Published · 10 min read
A small wooden ramp built from a plank resting on stacked books, with a toy car at the top, a notebook and a pencil on a light desk.

How do you find the slope of a line?

To find the slope of a line, divide the rise by the run. From two points, use m = (y2 − y1) ÷ (x2 − x1): the points (1, 2) and (4, 8) give 6 ÷ 3 = 2. On a graph, count the squares up and across between two points. In y = mx + b, the slope is the number m in front of x.

Key takeaways

  • The slope of a line is the rise divided by the run, so a line that climbs 6 units while it moves 3 units to the right has a slope of 6 ÷ 3 = 2.
  • The slope formula for two points is m = (y2 − y1) ÷ (x2 − x1), and the points (1, 2) and (4, 8) give (8 − 2) ÷ (4 − 1) = 2.
  • The slope of a line in the form y = mx + b is the number m in front of x, so y = 3x − 4 has a slope of 3 and crosses the y-axis at −4.
  • A line that rises from left to right has a positive slope, a falling line has a negative slope, a horizontal line has a slope of 0 and a vertical line has an undefined slope.
  • A road grade in percent is the slope × 100, so a road that climbs 8 feet over 100 feet of distance has an 8% grade.

A sign at the top of a hill says "8% grade", and your child's homework asks for the slope between two points on a grid. Both lead to the same question, what is slope, and the answer is how far something climbs for each step it moves forward. Learning how to find slope takes one formula, one picture and a habit of subtracting in the same order, and it works whether you start from two points, a graph or an equation.

What slope means: rise over run

Slope is a number that tells you how steep a line is and which way it goes. OpenStax Elementary Algebra 2e defines it in one line: "The slope of a line is the ratio of the rise to the run." The rise is the vertical change, the run is the horizontal change, and the slope is rise ÷ run, written with the letter m.

A slope of 2 means the line climbs 2 units for every 1 unit it moves right. A slope of 1/2 climbs 1 unit for every 2 units across, so it is half as steep. Because slope is a ratio, the guide to ratios is good background if fractions such as 6/3 feel rusty.

Slope sits at the center of grade 8 algebra. Common Core standard 8.EE.B.6 asks students to "use similar triangles to explain why the slope m is the same between any two distinct points on a non-vertical line in the coordinate plane". That sentence is the reason any two points on a line give the same answer.

Positive, negative, zero and undefined slope

Slope comes in four kinds, and the direction of the line tells you which one you have before you calculate anything. OpenStax puts the first two plainly: a line that goes up as you read from left to right "has positive slope", and a line going down "has negative slope".

A horizontal line has no rise, so its slope is 0. A vertical line has no run, and OpenStax states that "the slope of a vertical line, x=a, is undefined." Saying the sign out loud first ("this line falls, so the answer is negative") catches most sign errors later.

Each kind of slope describes a different real situation, from pay per hour to a wall.

Kind of slopeThe line goesExample pointsExample equationReal-life example
PositiveUp from left to right(1, 2) and (4, 8): slope 2y = 2xPay that grows with each hour worked
NegativeDown from left to right(0, 6) and (3, 0): slope −2y = −2x + 6A phone battery draining over time
ZeroFlat(1, 4) and (5, 4): slope 0y = 4A fixed monthly fee that does not change
UndefinedStraight up and down(3, 1) and (3, 6): run is 0x = 3A wall, which you cannot walk up
Four small coordinate grids side by side: a rising line marked +, a falling line marked −, a flat line marked 0 and a vertical line with no mark.
Four small coordinate grids side by side: a rising line marked +, a falling line marked −, a flat line marked 0 and a vertical line with no mark.

How to find slope from two points, step by step

The slope formula for two points is m = (y2 − y1) ÷ (x2 − x1): the change in y divided by the change in x. Take the points (1, 2) and (4, 8).

  1. Label the points. Call (1, 2) the first point, so x1 = 1 and y1 = 2. Call (4, 8) the second point, so x2 = 4 and y2 = 8.
  2. Find the rise. Subtract the y-values: y2 − y1 = 8 − 2 = 6. The line climbs 6 units.
  3. Find the run. Subtract the x-values in the same order: x2 − x1 = 4 − 1 = 3. The line moves 3 units right.
  4. Divide rise by run. m = 6 ÷ 3 = 2. Write it as a fraction first, 6/3, and simplify.
  5. Check the sign. The line rises from left to right, so a positive answer makes sense.
  6. Check with a third point. A slope of 2 means one step right adds 2 to y, so (5, 10) should be on the line: (10 − 2) ÷ (5 − 1) = 8 ÷ 4 = 2.
A coordinate grid with points A and B on a rising line, a coral run of 3 and a blue rise of 6 forming a right triangle, and 6 over 3 = 2, so m = 2.
A coordinate grid with points A and B on a rising line, a coral run of 3 and a blue rise of 6 forming a right triangle, and 6 over 3 = 2, so m = 2.
Play free in your browserSolve for XGrade 6+

The part people get wrong: subtracting in different orders

Subtracting the y-values in one order and the x-values in the other order flips the sign of the answer. For (1, 2) and (4, 8), the mixed version (8 − 2) ÷ (1 − 4) gives 6 ÷ (−3) = −2, which says the line falls when it rises.

Either order works if you keep it the same on top and bottom. Starting from the second point gives (2 − 8) ÷ (1 − 4) = −6 ÷ (−3) = 2, the same slope. Write both subtractions in one fraction before you calculate, with the same point first in each.

Negative coordinates need brackets. For (−2, 5) and (3, −5), the slope is (−5 − 5) ÷ (3 − (−2)) = −10 ÷ 5 = −2. If subtracting a negative number trips you up, the guide to negative numbers covers the rule.

How to find slope from a graph and from an equation

Slope on a graph is found by picking two points where the line crosses grid corners and counting. Count the squares up or down (the rise), count the squares to the right (the run) and divide. A line that drops 3 squares while it moves 4 squares right has a slope of −3/4.

Slope from an equation is fastest in slope-intercept form, y = mx + b. Common Core 8.EE.B.6 asks students to "derive the equation y = mx for a line through the origin and the equation y = mx + b for a line intercepting the vertical axis at b." In y = 3x − 4, the slope is 3 and the line crosses the y-axis at −4.

The fastest method depends on what you are given. Two points call for the formula, a drawn line calls for counting squares, and an equation calls for y = mx + b. A table of values works like two points: pick any two rows.

What if the equation is not in y = mx + b form?

An equation such as 2x + 3y = 12 hides its slope until you solve for y. Subtract 2x from both sides to get 3y = −2x + 12, then divide every term by 3: y = −2/3 x + 4. The slope is −2/3.

That rearranging is the same skill as solving an equation, step by step. The guide on how to solve for x walks through undoing addition and division on both sides.

Slope in real life: grades, roofs and rates

Slope turns up wherever something changes at a steady rate. A road sign that says "8% grade" means the road climbs 8 feet for every 100 feet of horizontal distance: a slope of 8/100, and slope × 100 = 8%. OpenStax states that "the grade of a road is its slope expressed as a percent", and the guide to percentages covers the conversion.

Wheelchair ramps follow a slope rule. The 2010 ADA Standards, section 405.2 say "ramp runs shall have a running slope not steeper than 1:12", which means 1 inch of rise for every 12 inches of run. A step 30 inches high therefore needs at least 30 × 12 = 360 inches of ramp run, which is 30 feet.

Play free in your browserPercentagesGrade 5+

Roof pitch and unit rates

Roof pitch is a slope written as rise over 12 inches of run. OpenStax notes that "the 'pitch' of a building's roof is the slope of the roof", and a 6/12 roof rises 6 inches for every 12 inches across, a slope of 6 ÷ 12 = 1/2.

A unit rate on a graph is also a slope. Common Core 8.EE.B.5 asks students to "graph proportional relationships, interpreting the unit rate as the slope of the graph." If you earn $90 for 6 hours of work, the line through (0, 0) and (6, 90) has a slope of 90 ÷ 6 = 15, which is $15 per hour.

How to check your progress with slope

Five short questions show whether you understand slope or are copying a formula. Try them without notes, then check.

  • Two points: find the slope through (2, 3) and (6, 11). The answer is 8 ÷ 4 = 2.
  • Negative points: find the slope through (−1, 4) and (3, −4). The answer is −8 ÷ 4 = −2.
  • The equation: name the slope and intercept of y = −5x + 7. The slope is −5 and the intercept is 7.
  • The hidden slope: find the slope of 4x + 2y = 10. Solving gives y = −2x + 5, so the slope is −2.
  • The flat and the vertical: give the slope of y = 6 and of x = 6. The first is 0, the second is undefined.

A ten-minute self-test

A ten-minute slope test mixes one question from each source: two points, a graph and an equation. Say the expected sign out loud before you calculate, and score yourself on the method as well as the answer.

Getting the method right but the arithmetic wrong points to the number facts, not the algebra. Common Core 8.F.B.4 expects students to find the rate of change "from two (x, y) values, including reading these from a table or from a graph", and every one of those steps leans on quick subtraction and division with negatives. The plan in how to get better at math as an adult shows how to rebuild those facts in short daily sessions.

Common slope mistakes and edge cases

Four mistakes cause most wrong slope answers, and each has a short fix.

  • Run over rise: dividing 3 ÷ 6 instead of 6 ÷ 3 gives 1/2 instead of 2. Say "rise over run" and put the y-values on top every time.
  • Mixed subtraction order: taking y2 − y1 on top but x1 − x2 below flips the sign. Write both subtractions with the same point first.
  • Sign errors with negatives: 3 − (−2) is 5, not 1. Put brackets around every negative coordinate before you subtract.
  • Reading b as the slope: in y = 4 + 3x, the slope is 3, the number attached to x. Rewrite the equation as y = 3x + 4 if the order confuses you.

Edge case: a vertical line has an undefined slope

A vertical line has the same x-value at every point, so the run is 0 and the formula divides by zero. For (3, 1) and (3, 6), the slope would be (6 − 1) ÷ (3 − 3) = 5 ÷ 0, which has no answer.

Undefined is different from zero. A horizontal line through (1, 4) and (5, 4) gives 0 ÷ 4 = 0, a real slope that means "flat". A vertical line gives a division by zero, so the slope does not exist, and its equation is written x = 3 instead of y = mx + b.

Your slope checklist and next steps

  • Sign first: look at the line and say whether the slope is positive, negative, zero or undefined.
  • Two points: use m = (y2 − y1) ÷ (x2 − x1) with the same point first on top and bottom.
  • Brackets: wrap every negative coordinate in brackets before subtracting.
  • Simplify: write the slope as a fraction, then reduce it, such as 6/3 = 2.
  • Equations: solve for y to reach y = mx + b, then read m.
  • Check: test a third point or the graph to confirm the answer.

The free solve for x game in the browser practices the equation steps behind slope-intercept form, with no sign-up. Adults rebuilding algebra can also try the math game for adults.

Practise it in the MathIt app

About 90 math games with adaptive difficulty, daily practice and 2–5 player battles — free on iOS and Android.

Download on the App StoreGet it on Google Play

MathIt is a free app for iOS and Android with about 90 game types, adaptive difficulty and short daily practice that keeps the arithmetic behind slope quick: negative numbers, fractions and division. You can also challenge 1 to 4 friends in real-time math battles, in any of 33 languages.

Frequently asked questions

What is slope?

Slope is a number that measures how steep a line is and which way it goes. It equals the rise (the vertical change) divided by the run (the horizontal change) between any two points on the line. A slope of 2 means the line goes up 2 units for every 1 unit it moves to the right.

What is slope-intercept form?

Slope-intercept form is the equation of a line written as y = mx + b, where m is the slope and b is the y-intercept, the point where the line crosses the y-axis. In y = 2x + 5, the slope is 2 and the line crosses the y-axis at 5. Common Core standard 8.EE.B.6 asks grade 8 students to derive this equation.

What does a negative slope mean?

A negative slope means the line goes down as you read it from left to right. A slope of −2 means y falls by 2 for every 1 unit x increases. In real life, a negative slope describes something that shrinks over time, such as a phone battery that drops from 100% as the hours pass.

What is the slope of a horizontal line and a vertical line?

The slope of a horizontal line is 0, and the slope of a vertical line is undefined. A horizontal line has no rise, so the slope is 0 ÷ run = 0. A vertical line has no run, so the formula asks you to divide by zero, which has no answer.

How do you find slope with two points?

Slope with two points is found by subtracting the y-values, subtracting the x-values in the same order, and dividing: m = (y2 − y1) ÷ (x2 − x1). For the points (2, 3) and (6, 11), the slope is (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2.

Similar topics

All articles →