Slope-intercept form is the way of writing a linear equation as \(y = mx + b\), where \(m\) is the slope of the line and \(b\) is the y-intercept — the point where the line crosses the y-axis. It is the most useful form for graphing because you can read the slope and the starting point straight off the equation. On this page you will see what \(m\) and \(b\) mean, how to graph a line from them, how to find the slope from two points, and how to write your own equation — with worked examples and an interactive trainer.
What is slope-intercept form?
Every straight (non-vertical) line can be written in slope-intercept form:
The two letters \(m\) and \(b\) are the only things that change from one line to another. Read them off the equation like this:
- \(m\) — the slope. It tells you how steep the line is and which way it tilts. Slope means rise over run: how many units the line goes up (or down) for every one unit it moves to the right.
- \(b\) — the y-intercept. It is the \(y\)-value where the line crosses the vertical axis, i.e. the point \((0, b)\). When \(x = 0\), the \(mx\) term disappears and \(y = b\).
For example, in \(y = 2x + 3\) the slope is \(m = 2\) and the y-intercept is \(b = 3\), so the line crosses the y-axis at \((0, 3)\) and climbs 2 units for every 1 unit to the right.
m = slope
How steep the line is: rise over run. Positive tilts up, negative tilts down.
b = y-intercept
Where the line crosses the y-axis, at the point (0, b).
How to graph slope-intercept form
Graphing a line from \(y = mx + b\) takes three easy steps — no table of values needed:
- Plot the y-intercept. Put a point on the y-axis at \((0, b)\). This is your starting point.
- Use the slope to find a second point. Write \(m\) as a fraction \(\frac{\text{rise}}{\text{run}}\). From the first point, move up (rise) and right (run). A whole-number slope like \(2\) is just \(\frac{2}{1}\).
- Draw the line through the two points and extend it both ways.
The grid below graphs \(y = 2x + 1\): the y-intercept is at \((0, 1)\), and the slope \(2 = \frac{2}{1}\) means up 2, right 1 to reach the next point \((1, 3)\).
How to find slope and y-intercept
From an equation. If it is already in \(y = mx + b\) form, the number multiplying \(x\) is the slope \(m\), and the constant term is the y-intercept \(b\). Watch the signs: in \(y = -3x - 4\), the slope is \(m = -3\) and the y-intercept is \(b = -4\). If the equation looks different (say \(2x + y = 5\)), solve for \(y\) first: \(y = -2x + 5\), so \(m = -2\) and \(b = 5\).
Slope from two points. Given two points \((x_1, y_1)\) and \((x_2, y_2)\), the slope is the change in \(y\) divided by the change in \(x\):
For the points \((1, 2)\) and \((3, 8)\): \(m = \frac{8 - 2}{3 - 1} = \frac{6}{2} = 3\). Subtract the coordinates in the same order on top and bottom, or you will flip the sign.
Writing equations in slope-intercept form
To write an equation, you just need the slope \(m\) and the y-intercept \(b\), then drop them into \(y = mx + b\).
- Given slope and y-intercept. With \(m = -2\) and \(b = 5\), the equation is \(y = -2x + 5\). Done.
- Given the slope and one point. Plug the slope and the point \((x, y)\) into \(y = mx + b\) and solve for \(b\). Example: slope \(m = 4\) through \((2, 3)\) gives \(3 = 4(2) + b\), so \(b = 3 - 8 = -5\) and the equation is \(y = 4x - 5\).
- Given two points. First find the slope with the formula above, then use one point to solve for \(b\), exactly as in the previous step.
The sign of the slope tells you at a glance which way the finished line will go.
| Slope m | Line direction | Example |
|---|---|---|
| m > 0 | Rises from left to right (uphill) | y = 2x + 1 |
| m < 0 | Falls from left to right (downhill) | y = -2x + 4 |
| m = 0 | Horizontal — a flat line | y = 3 |
| undefined | Vertical — not slope-intercept form | x = 5 |
Slope-intercept form examples
Example 1. Read m and b, then graph
Equation: \(y = \frac{1}{2}x - 2\)
Step 1 — identify the parts. The slope is \(m = \frac{1}{2}\) and the y-intercept is \(b = -2\).
Step 2 — plot the y-intercept. Put a point at \((0, -2)\) on the y-axis.
Step 3 — use the slope. \(m = \frac{1}{2}\) means up 1, right 2. From \((0, -2)\) move to \((2, -1)\), then to \((4, 0)\).
Step 4 — draw the line through those points. It rises gently because the slope is positive but less than 1.
Example 2. Find the slope from two points
Points: \((-1, 4)\) and \((2, -2)\)
Step 1 — apply the formula. \(m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{-2 - 4}{2 - (-1)} = \frac{-6}{3} = -2\).
Step 2 — check the sign. The slope is negative, so the line falls from left to right. That matches the points: as \(x\) goes up, \(y\) goes down.
The slope of this line is \(m = -2\).
Example 3. Write the equation from slope and a point
Given: slope \(m = 3\), passing through \((2, 1)\).
Step 1 — start from \(y = mx + b\) with \(m = 3\): \(\; y = 3x + b\).
Step 2 — substitute the point \((2, 1)\): \(\; 1 = 3(2) + b = 6 + b\).
Step 3 — solve for b: \(\; b = 1 - 6 = -5\).
Equation: \(y = 3x - 5\).
Example 4. Rearrange into slope-intercept form
Equation: \(4x + 2y = 6\)
Step 1 — isolate the y-term. Subtract \(4x\) from both sides: \(2y = -4x + 6\).
Step 2 — divide by 2: \(\; y = -2x + 3\).
Step 3 — read off m and b. Now it is in slope-intercept form: slope \(m = -2\), y-intercept \(b = 3\).
Common mistakes with slope-intercept form
-
Swapping m and b — reading the slope as the constant term (or vice versa).
The slope m is always the number multiplied by x; the y-intercept b is the number by itself. In y = 5x + 2, the slope is 5 and the y-intercept is 2 — never the other way around.
-
Dropping the sign of the slope, e.g. calling the slope of y = -3x + 1 just 3.
The minus sign is part of the slope. Here m = -3, which means the line falls. A negative slope always goes downhill from left to right.
-
Mixing up rise and run — moving right first, then up, so the slope gets inverted.
Slope is rise over run, not run over rise. A slope of 2 = 2/1 means up 2 for every 1 to the right; a slope of 1/2 means up 1 for every 2 to the right. Keep rise on top.
-
Reading the y-intercept as an x-value, e.g. plotting b = 3 at (3, 0) instead of (0, 3).
The y-intercept lives on the y-axis: b is always the point (0, b). Start every graph by moving up or down the y-axis, not across the x-axis.
-
Subtracting the coordinates in different orders in the slope formula.
Use the same order on top and bottom: m = (y2 - y1) / (x2 - x1). If you start with the second point's y on top, start with the second point's x on the bottom too, or the sign will flip.
Frequently asked questions
What is slope-intercept form?
Slope-intercept form is the equation of a straight line written as y = mx + b, where m is the slope and b is the y-intercept. It is the most convenient form for graphing, because both the steepness (m) and the starting point on the y-axis (b) are visible right in the equation.
What do m and b stand for in y = mx + b?
m is the slope — how steep the line is and whether it rises or falls, measured as rise over run. b is the y-intercept — the y-value where the line crosses the vertical axis, i.e. the point (0, b).
How do you find the slope from two points?
Use the slope formula m = (y2 - y1) / (x2 - x1): subtract the two y-values on top and the matching x-values on the bottom. For example, for (1, 2) and (3, 8), m = (8 - 2) / (3 - 1) = 6 / 2 = 3.
How do you graph a line in slope-intercept form?
First plot the y-intercept at (0, b). Then use the slope as rise over run to step to a second point — up (or down) for the rise, right for the run. Draw a straight line through the two points and extend it in both directions.
How do you write an equation in slope-intercept form?
Find the slope m and the y-intercept b, then substitute them into y = mx + b. If you only have the slope and one point, plug the point into the equation and solve for b first. If you have two points, find the slope with the formula, then solve for b.
What does the sign of the slope tell you?
A positive slope means the line rises from left to right; a negative slope means it falls. A slope of 0 makes a horizontal line, and a vertical line has an undefined slope, which cannot be written in slope-intercept form.