Slope-Intercept Form: How to Graph and Write y = mx + b
Slope-intercept form is the equation of a straight line written as y = mx + b. The number m is the slope — how much y changes when x increases by 1 — and b is the y-intercept, the point (0, b) where the line crosses the y-axis. To graph it, plot (0, b) and use the slope as rise over run.
Check it yourself: every example here can be loaded into the Slope Intercept Form Calculator.
Open the Slope Intercept Form CalculatorThe two numbers in y = mx + b
- m, the slope, measures steepness and direction. It is the change in y divided by the change in x — “rise over run”. A slope of 2⁄3 means: go 3 units right, then 2 units up.
- b, the y-intercept, is the value of y when x = 0. The line always passes through the point (0, b).
| Equation | Slope m | y-intercept b | Description |
|---|---|---|---|
| y = 3x + 2 | 3 | 2 | rises steeply, crosses at (0, 2) |
| y = −½x + 4 | −½ | 4 | falls gently, crosses at (0, 4) |
| y = 5 | 0 | 5 | horizontal line |
| y = x | 1 | 0 | diagonal through the origin |
Text description of this figure
Two panels. Left: lines y = 2x + 1, y = 0.5x + 1 and y = −x + 1 share the y-intercept 1 but have different slopes. Right: lines y = x + 3, y = x and y = x − 2 share the slope 1 but have different y-intercepts.
- m > 0 rises to the right; m < 0 falls; m = 0 is horizontal.
- A larger |m| means a steeper line.
- b is where the line crosses the y-axis.
How to graph a line in slope-intercept form
Graph y = (2⁄3)x − 1.
- Plot the y-intercept. b = −1, so plot (0, −1).
- Use the slope as rise over run. m = 2⁄3: from (0, −1) move 3 right and 2 up to reach (3, 1).
- Repeat or reverse for a third point: 3 more right and 2 more up gives (6, 3); or 3 left and 2 down gives (−3, −3).
- Draw the line through the points and extend it in both directions.
A negative slope works the same way: for m = −2⁄5, go 5 right and 2 down.
- Graph y = (2/3)x − 1 — opens the Slope Intercept Form Calculator
How to write the equation from a graph
- Read b where the line crosses the y-axis.
- Pick two clear grid points on the line and count the rise and run between them.
- Divide: m = rise ⁄ run (negative if the line falls).
- Write y = mx + b.
If the line crosses the y-axis between grid lines, b is hard to read. Use the two-point method instead.
How to write the equation from two points
Find the line through (1, 2) and (3, 5).
- Slope: m = (5 − 2) ⁄ (3 − 1) = 3⁄2.
- Intercept: substitute one point into y = mx + b: 2 = (3⁄2)(1) + b, so b = 2 − 3⁄2 = 1⁄2.
- Equation: y = (3⁄2)x + 1⁄2.
- Check with the other point: (3⁄2)(3) + 1⁄2 = 9⁄2 + 1⁄2 = 5 ✓.
- Line through (1, 2) and (3, 5) — opens the Slope Intercept Form Calculator
Converting from standard form
Lines are often given in standard form, Ax + By = C. To get slope-intercept form, solve for y:
2x + 3y = 6 → 3y = −2x + 6 → y = −(2⁄3)x + 2.
The slope is −A⁄B and the y-intercept is C⁄B.
- Convert 2x + 3y = 6 to y = mx + b — opens the Slope Intercept Form Calculator
What the slope means in context
In a real situation, m is a rate and b is a starting value. A taxi fare of y = 2.5x + 4 dollars for x miles means a $4 starting fee plus $2.50 per mile. A phone that loses battery as y = −8x + 100 starts at 100% and drops 8 percentage points per hour.
Common mistakes
- Swapping rise and run. Slope is vertical change over horizontal change: Δy ⁄ Δx.
- Using b as the x-intercept. b is on the y-axis. The x-intercept of y = mx + b is −b ⁄ m.
- Forgetting the sign of b. y = 2x − 3 has b = −3.
- Reading y = 4 − 2x as m = 4. Rearrange first: y = −2x + 4, so m = −2.
For a line through a known point that is not on the y-axis, point-slope form is often quicker. To review slope itself, see how to find slope.
Questions
What do m and b stand for?
They are just conventional letters: m for slope and b for the y-intercept. Some countries write y = mx + c or y = ax + b; the meaning is the same.
Can every line be written in slope-intercept form?
Every line except vertical ones. A vertical line x = 4 has an undefined slope and never crosses the y-axis (unless it is the y-axis itself), so it has no m or b.
How do I convert standard form to slope-intercept form?
Solve for y. From Ax + By = C, subtract Ax and divide by B: y = (−A/B)x + C/B.
Graph your own example with the Slope Intercept Form Calculator — free, in your browser.
Try it nowSources and further reading
- OpenStax, Elementary Algebra 2e — 4.5 Use the Slope-Intercept Form of an Equation of a Line
- OpenStax, College Algebra 2e — 4.1 Linear Functions
Worked examples and figures were produced and checked with the Graphing Calculator Lab engine. See the editorial policy.