Skip to content
ihateDesmos

Slope-intercept form

7 min read · Updated 6 November 2026

Slope-intercept form writes a straight line as y = mx + b, where m is the slope and b is the y-intercept. It is the most useful way to write a line, because you can read both numbers straight off the equation and draw the graph in seconds.

The formula

y=mx+b
  • m is the slope: how far the line goes up for each 1 you move right. A positive m rises, a negative m falls, and a larger size means steeper.
  • b is the y-intercept: where the line crosses the y-axis, at the point (0, b).

In y = 2x + 1, the slope is 2 and the line crosses the y-axis at (0, 1). In y = -3x + 4, the slope is −3 and the intercept is (0, 4). In y = 5x, there is no number on the end, so b = 0 and the line goes through the origin.

−4−224−2240
Open in calculator
Three lines:
y=2x+1
rises steeply,
y=−0.5x+3
falls gently, and
y=2
has slope 0, so it is flat.

How to graph a line in slope-intercept form

To graph y = 2x + 1:

  1. Plot the y-intercept. b = 1, so put a point at (0, 1).
  2. Use the slope to find another point. m = 2 means up 2 for every 1 right, so from (0, 1), move to (1, 3). If the slope is a fraction, like 2/3, it tells you directly: up 2, right 3.
  3. Draw the line through the two points and extend it in both directions.

For a negative slope like −3, go down 3 for every 1 right.

How to write the equation of a line

From a graph

Read where the line crosses the y-axis to get b. Then pick two clear points and work out rise ÷ run to get m.

From two points

For (1, 3) and (3, 7):

  1. Find the slope: m = (7 − 3) ÷ (3 − 1) = 4 ÷ 2 = 2.
  2. Put m and one point into y = mx + b: 3 = 2(1) + b.
  3. Solve for b: b = 1.
  4. Write the answer: y = 2x + 1.

The slope calculator does this for any two points, and keeps fractions exact.

From a slope and a point

With slope 3 through (2, 5): 5 = 3(2) + b, so b = −1, and the line is y = 3x − 1.

Converting from standard form

To turn a line in standard form, Ax + By = C, into slope-intercept form, solve for y:

  1. Start with 3x + 2y = 8.
  2. Subtract 3x from both sides: 2y = −3x + 8.
  3. Divide everything by 2: y = −(3/2)x + 4.

So the slope is −3/2 and the y-intercept is 4. In general, y = −(A/B)x + C/B.

Parallel and perpendicular lines

Parallel lines have the same slope. So y = 2x + 1 and y = 2x − 3 never meet.

Perpendicular lines have slopes that multiply to −1: flip the slope and change its sign. A line perpendicular to y = 2x + 1 has slope −1/2.

−4−224−4−2240
Open in calculator
The blue and green lines are parallel, with slope 2. The red line, with slope −1/2, is perpendicular to both.

What m and b mean in real life

Slope-intercept form describes anything with a fixed starting value and a steady rate of change. A taxi charging a $3 fee plus $2 per mile costs y = 2x + 3 dollars for x miles: the slope is the rate per mile, and the intercept is the fixed fee.

A phone with 80% charge that loses 5% per hour has y = −5x + 80: the negative slope means the value falls over time.

Common mistakes

  • Mixing up m and b. m multiplies x, and b stands alone. In y = 4 + 3x, the slope is 3, not 4.
  • Plotting the slope backwards. A slope of 2/3 is up 2, right 3. The rise is on top.
  • Forgetting a negative sign in b. y = 2x − 5 crosses the y-axis at (0, −5).
  • Trying to write a vertical line this way. A vertical line has no defined slope, so it can’t be written as y = mx + b. It looks like x = 3.

Frequently asked questions

What is slope-intercept form?
A way of writing a straight line as y = mx + b, where m is the slope and b is the y-intercept.
How do you find the slope from y = mx + b?
It is the number multiplying x. In y = −4x + 7, the slope is −4.
What is the difference between slope-intercept form and point-slope form?
Slope-intercept form, y = mx + b, shows the slope and y-intercept. Point-slope form, y − y₁ = m(x − x₁), shows the slope and any point on the line. They describe the same lines.
What is b if the line goes through the origin?
0. The equation is simply y = mx.
Can every line be written in slope-intercept form?
Every line except a vertical one, which has an undefined slope. Vertical lines are written x = a.

Keep going

Try it in the calculator

Every figure on this page opens in ihateDesmos, where you can drag sliders and watch the graph respond.

Open the calculator