Slope Intercept Form

b m positive m = 0 m negative

y = mx + b  same b, three different values of m

Three lines in slope intercept form through the same intercept. They share a b and differ only in m, which tilts a line up, flat or down.

Slope intercept form is a way of writing the equation of a straight line so that its two most useful numbers are visible at a glance: the slope, and the point where the line crosses the y-axis. Any line except a vertical one can be written this way, and reading it takes no working out at all.

What slope intercept form is, and why it has that name

A straight line can be written down in several ways, all describing the same line. Slope intercept form is the arrangement that puts the slope and the intercept on display.

The name is not a label somebody attached afterwards. It is a description of the two numbers the form hands you:

  • the slope, how steeply the line rises or falls
  • the intercept, where it crosses the vertical axis

Every other way of writing a line hides at least one of those. That is the whole reason this form is the one people reach for first.

The slope also tells you how one line relates to another. Two different lines with the same slope but different intercepts are parallel and never meet, however far you extend them. And for two lines that are neither vertical nor horizontal, crossing at a right angle means their slopes multiply to −1, which is the rule behind perpendicular slope. The horizontal and vertical pair are perpendicular too, but they sit outside that test, because one of the two slopes does not exist to be multiplied.

The slope intercept formula, and why it works

Written out, the formula is y = mx + b, with m the slope and b the intercept.

It is worth seeing once why the two numbers land where they do, rather than taking it on trust.

Why the constant is the intercept. The intercept is by definition the value of y when x is 0. Put 0 in for x and the first term vanishes, leaving y = b. So the constant is not merely near the intercept, it is the intercept.

Why the coefficient is the slope. Increase x by exactly 1 and the first term grows by m while the constant does not move, so y grows by m. That is what slope means: the change in y for a change of 1 in x.

OpenStax puts the general rule this way: when a linear equation is solved for y, the coefficient of the x term is the slope and the constant is the y-coordinate of the intercept. Which is a useful thing to remember, because it means getting y on its own is the whole job. Every conversion further down this page is that one move.

How to find slope intercept form from what you have

Four starting positions cover almost everything you will be handed.

From a slope and the intercept

Nothing to do but write them in. Slope 4, intercept −2, gives y = 4x − 2.

From a slope and any point

Substitute the point and solve for the constant. Slope 3 through (4, 5): 5 = 3(4) + b, so 5 = 12 + b, so b = −7. The equation is y = 3x − 7.

From two points

Find the slope first, then use the method above with either point. Through (1, 5) and (4, 14): the slope is (14 − 5) ÷ (4 − 1) = 3. Then 5 = 3(1) + b gives b = 2, so y = 3x + 2. Check with the other point: 3(4) + 2 = 14.

From a graph

Read the intercept off the vertical axis, then count rise over run between two points the line passes through cleanly. Pick points where the line crosses corners of the grid rather than guessing at a value between them.

(0, 2) (3, 4) run 3 rise 2
The intercept is read straight off the axis. The slope is counted between two grid corners.

Worked through: the line crosses the vertical axis at 2, so b = 2. The next corner it passes through cleanly is 3 across and 2 up, so m = 2/3. The equation is y = 2/3 x + 2.

Check it before moving on. At x = 3 the equation gives 2/3 × 3 + 2 = 4, which is the second point. If your two points had been 3 across and 2 down, the slope would be −2/3, and the only thing telling you which is the direction the line travels as you move right.

The two-point method has a trap in the arithmetic rather than the idea. The subtractions have to run in the same order. With (1, 5) and (4, 14), either (14 − 5) ÷ (4 − 1) or (5 − 14) ÷ (1 − 4) gives 3. Mixing them, (14 − 5) ÷ (1 − 4), gives −3.

The reason it slips through is that −3 is a perfectly sensible looking answer. The line comes out as a mirror image, the equation still passes through neither point, and nothing about the number itself looks wrong. Substituting one of the original points back into the finished equation catches it in seconds, and is worth doing every time.

If you would rather have the arithmetic done and checked for you, the slope intercept form calculator takes two points or a slope and a point and shows the working.

How to graph slope intercept form

When an equation is already in this form it is especially quick to graph, because the first point is handed to you rather than calculated.

  1. Plot the intercept on the vertical axis.
  2. From there, count the slope: 1 across, then up by the slope. A slope of 2 is 1 right and 2 up.
  3. A negative slope counts downwards. A slope of −2 is 1 right and 2 down.
  4. A fractional slope is easier used as it stands. For 2/3, go 3 across and 2 up rather than trying to measure two thirds of a square.
  5. Mark the second point and draw the line through both. A third point, counted the same way again, is a free check that you have not slipped.

Converting an equation from standard form

Equations often arrive as Ax + By = C, with the x and y terms on the same side. That version hides both numbers, so the first thing to do is get y on its own.

Take 3x + 4y = 20.

  1. Move the x term across: 4y = −3x + 20
  2. Divide every term by 4: y = −3/4 x + 5

Slope −3/4, intercept 5.

Step 2 is where marks are lost. Every term gets divided, including the constant. Dividing the x term and forgetting the 20 leaves you with an equation for a different line, and it looks perfectly tidy.

Going back the other way is the same idea in reverse: clear any fractions by multiplying through, then move the x term to the left so both variables sit together.

Horizontal and vertical lines

These two look like a matching pair and behave completely differently, which is why they are worth taking together.

A horizontal line has a slope of 0. Move along it and y never changes, so the rise is 0 for any run. Put m = 0 into the form and the x term disappears, leaving y = b. So y = −2 is a horizontal line crossing the vertical axis at −2, and its slope is 0. It fits the form perfectly well; the slope simply happens to be zero.

A vertical line has no slope at all. Move along it and x never changes, so the run is 0, and slope would need a division by zero. There is no value of m to write down, so a vertical line cannot be put in this form at any price. It is written x = a number instead, such as x = 3.

Zero and undefined are not two ways of saying the same thing. One is a number the form accepts happily. The other is the single case the form cannot describe.

One more thing the name can mislead people about. The intercept in slope intercept form always means the y-intercept, never both. If you do want the x-intercept, set y to 0 and solve, which gives x = −b/m for any line whose slope is not 0. A horizontal line has no x-intercept unless it is the x-axis itself.

Practice questions, with the answers

Five questions covering the things on this page that most often go wrong.

  1. Give the slope and intercept of y = −6x + 11.
  2. Write the equation of the line with slope −2 through the point (3, 1).
  3. Write the equation of the line through (2, 7) and (6, 19).
  4. Rewrite 5x + 2y = 12 so the slope and intercept can be read off it.
  5. What are the slope and intercept of y = 7? What about x = 7?
Show the answers
  1. Slope −6, intercept 11.
  2. 1 = −2(3) + b, so b = 7. The equation is y = −2x + 7.
  3. Slope is (19 − 7) ÷ (6 − 2) = 3. Then 7 = 3(2) + b gives b = 1, so y = 3x + 1.
  4. 2y = −5x + 12, then y = −5/2 x + 6. Slope −5/2, intercept 6. Both terms divided by 2, including the 12.
  5. y = 7 is horizontal: slope 0, intercept 7. x = 7 is vertical: the slope is undefined and there is no intercept on the vertical axis at all, because the line never touches it.

Frequently asked questions

How do you convert an equation to slope intercept form?

Solve it for y. Whatever shape the equation arrives in, the job is the same: get y by itself on the left with a coefficient of 1, doing the same thing to every term on both sides. Once y is alone, the number multiplying x is the slope and the number on its own is the intercept, with no further work.

What is the slope and y-intercept of an equation like y = −2?

The slope is 0 and the intercept is −2. There is no x term because the slope is zero, and a zero times x contributes nothing, so it is not written. The line is horizontal at a height of −2. People often answer that there is no slope, but no slope and a slope of zero are different things, and this one has a slope of zero.

Is slope intercept form better than the other forms?

Better for reading and for graphing, not better in general. It wins when you want to see the slope and intercept, plot the line quickly, or put the relationship into a spreadsheet.

It is the wrong choice when the intercept is not something you know or care about, which is common with measured data, and when you are solving two equations together, where having both variables on one side is tidier. It also cannot describe a vertical line. The forms are tools, not rankings.

Can the slope or the intercept be a fraction or a decimal?

Both can be either, and fractions are usually the better choice. A slope of 1/3 is exact and tells you directly to count 3 across and 1 up. Written as 0.333 it is neither. Keep fractions as fractions unless you have been asked for a decimal, and if you must round, round at the very end rather than partway through.

Why does my equation look different from the answer in the book?

In this form, it should not. Unlike some other ways of writing a line, where several different-looking equations describe the same line, slope intercept form has exactly one version per line once y is on its own. If yours differs, one of them is wrong.

Test it rather than guessing. Pick any x, work out y from both equations, and compare. Two different answers means two different lines, and the usual culprit is a term that did not get divided, or a sign lost while moving a term across.