Skip to calculator

y = mx + b

Slope-intercept form calculator.

Enter two points, or a point and a slope, and get the equation of the line in y = mx + b form — with m and b as exact fractions and the algebra written out.

The Equation

y = 1/3x + 5/3

Slope (m)

1/3

= 0.333333

y-intercept (b)

5/3

x-intercept

−5

Angle

18.4349°

Point-Slope Form

y − 2 = 1/3(x − 1)

Standard Form

x − 3y = −5

XY−0.50.51.01.52.02.53.03.54.04.5−0.50.51.01.52.02.53.03.5run 3rise 1(1, 2)(4, 3)

Interactive graph. Drag to pan, or scroll to zoom. With the graph focused, use the arrow keys to pan, plus and minus to zoom, and 0 to reset the view.

A rising line through (1, 2) and (4, 3), with slope 0.3333, drawn on a grid with the rise and run marked.

Step-by-Step Solution

    Reading y = mx + b

    Slope-intercept form is the most practical way to write a line, because both numbers you need to draw it are visible without any rearranging. In y = mx + b, the m is the slope — how far the line climbs for every one unit it moves right — and the b is the y-intercept, the height at which it crosses the vertical axis.

    To graph it by hand you plot the point (0, b), then step out from there using the slope. With y = (1/3)x + 5/3 you start at 5/3 on the y-axis, move three units right, one unit up, and plot a second point. Join them and the line is done.

    Getting There From Two Points

    Building the equation from a pair of points takes two steps, in this order:

    1. Find m. Divide the change in y by the change in x. For (1, 2) and (4, 3) that is (3 − 2) ÷ (4 − 1) = 1/3.
    2. Find b. Put the slope and either point back into y = mx + b and solve. Using (1, 2): 2 = (1/3)(1) + b, so b = 5/3.

    Use the other point as a check — substituting (4, 3) should also work: (1/3)(4) + 5/3 = 4/3 + 5/3 = 3. It does, so the equation is right. This calculator keeps m and b as exact fractions throughout, because rounding the slope to 0.33 early makes the intercept wrong by enough to notice.

    Converting Between the Three Forms

    The same line can be written three ways, and each is convenient for something different:

    • Slope-intercept, y = mx + b — best for graphing and for reading the slope at a glance.
    • Point-slope, y − y₁ = m(x − x₁) — best when you are handed a point and a slope, since you can write it down with no algebra at all.
    • Standard, Ax + By = C — best for solving systems of equations, and the only one of the three that can also describe a vertical line.

    Going from standard to slope-intercept is a matter of solving for y: from 2x + 3y = 6, subtract 2x to get 3y = −2x + 6, then divide by 3 to reach y = −2/3x + 2. Going the other way, multiply out any fractions and move the x-term across.

    Common Questions

    What is slope-intercept form?

    Slope-intercept form writes a line as y = mx + b, where m is the slope and b is the y-intercept — the y-value where the line crosses the vertical axis. It is the most useful form for graphing, because the two numbers you need are sitting right there in the equation.

    How do I find b once I know the slope?

    Substitute the slope and any point on the line into y = mx + b and solve for b. With a slope of 1/3 through the point (1, 2): 2 = (1/3)(1) + b, so b = 2 − 1/3 = 5/3. Any point on the line gives the same answer.

    How do I convert standard form to slope-intercept form?

    Solve Ax + By = C for y. Subtract Ax from both sides to get By = −Ax + C, then divide everything by B, giving y = (−A/B)x + C/B. So the slope is −A/B and the y-intercept is C/B. For 2x + 3y = 6 the slope is −2/3 and the intercept is 2.

    Can every line be written in slope-intercept form?

    No. A vertical line such as x = 4 has an undefined slope and never crosses the y-axis at a single point, so there is no m and no b to write down. Every other line — including horizontal ones, where m is simply 0 — can be written as y = mx + b.

    What does b tell you about the graph?

    b is where the line crosses the y-axis, so it sets the line’s vertical position. Changing b slides the whole line up or down without tilting it, while changing m rotates the line around that crossing point.