Slope Intercept Form Calculator
Slope intercept form writes a line as y = m x + b. Here m is the slope and b is the height where the line crosses the y axis. Give the calculator two points and it returns the slope, the intercept and the finished equation, with tidy output for slopes of 1 and 0.
| Slope m | |
| Intercept b | |
| Equation |
m = (y2 - y1) / (x2 - x1) and b = y1 - m x x1. Both values print to six decimal places, and the equation drops a coefficient of 1, a slope of 0 and an intercept of 0.
Two points with the same x value form a vertical line. That line has no defined slope and no slope intercept form, so the calculator reports the vertical line instead.
All calculations happen in your browser, and no data is uploaded.
Enter two points and get the slope, the y intercept and the equation in y = m x + b form, with clean output for horizontal, vertical and negative slopes.
Key takeaways
- Slope intercept form is y = m x + b, with m the slope and b the y intercept
- From two points: m = (y2 - y1) / (x2 - x1), then b = y1 - m x x1
- For (1, 3) and (5, 11) the slope is 2, the intercept is 1, and the line is y = 2x + 1
- Horizontal lines have a slope of 0 and equations like y = 6; vertical lines have no slope and no slope intercept form
- Standard form 2x + 4y = 12 is the same line as y = -0.5x + 3
On this page
What slope intercept form is
Slope intercept form writes a straight line as y = m x + b. The letter m is the slope, the number of units the line rises for each unit it moves right. The letter b is the y intercept, the height where the line crosses the vertical axis. Read the equation as a set of instructions: start at b on the y axis, then step one unit right and m units up, and keep repeating.
The form is popular because both numbers can be read straight off the equation and both mean something on a graph. Take y = 2x + 1. It crosses the y axis at (0, 1), and from there each step of one to the right lifts the line by two. Two steps to the right put it at (2, 5), and four steps put it at (4, 9). No rearrangement is needed to sketch the line, and no table of values is needed to find its steepness.
Every straight line except a vertical one can be written this way, and the writing is unique: one line has exactly one m and one b. Vertical lines are the exception because their slope is undefined, so they get the separate equation x = a constant instead.
The letters are worth pinning down because they get swapped in a hurry. m is steepness and b is position. A line with a large m is steep, a line with m of zero is flat, and b moves the whole line up or down without tilting it.
The two formulas the calculator uses
Given two points, the slope comes from the rise over the run: m = (y2 - y1) / (x2 - x1). Subtract the y values in the same order you subtract the x values, and the sign takes care of itself. A line that falls from left to right gives a negative m, and the formula reports it without extra rules.
With m in hand, the intercept follows from either point. Put the point into y = m x + b and solve for b, which gives b = y1 - m x x1. Use the same point you subtracted first in the slope step and the arithmetic stays tidy.
The calculator takes four numbers, x1, y1, x2 and y2, and returns three things: the slope, the intercept and the finished equation. It prints m and b to six decimal places, which is enough for typical homework and for coordinates read off a graph, and it assembles the equation in a readable style: a slope of 1 prints as x rather than 1x, a slope of -1 prints as -x, an intercept of zero drops out of the equation, and a negative intercept prints with a minus sign rather than a plus and a negative number.
If the two x values match, the run is zero and the division has no answer. The calculator reports a vertical line through that x value instead of inventing a slope, which is the honest output: a vertical line has no slope intercept form at all.
Worked example: (1, 3) and (5, 11)
Take the points (1, 3) and (5, 11). Label them so the subtraction stays consistent: x1 is 1, y1 is 3, x2 is 5, y2 is 11.
The slope is m = (11 - 3) / (5 - 1) = 8 / 4 = 2. The line rises 8 units over a run of 4, so it rises 2 units per unit right.
The intercept comes from the first point: b = 3 - 2 x 1 = 1. The line crosses the y axis at (0, 1), and the equation is y = 2x + 1.
A check with the second point closes the loop. Put x = 5 into the equation: 2 x 5 + 1 = 11, which matches the y value of the second point. The check costs one line and catches the most common error, a sign flipped during the subtraction.
| x | y = 2x + 1 | Point on the line |
|---|---|---|
| 0 | 1 | (0, 1), the y intercept |
| 1 | 3 | (1, 3), the first given point |
| 2 | 5 | (2, 5) |
| 3 | 7 | (3, 7) |
| 5 | 11 | (5, 11), the second given point |
Reading the table backward is a useful skill as well. The jump from y of 3 to y of 5 as x moves from 1 to 2 is the slope showing up in the data, and the flat run of 1 at x of 0 is the intercept.
More point pairs, worked out
The same two formulas handle every pair, including the cases where the answers are fractions, zero or negative. The table works four of them through, with the arithmetic in the middle columns.
| Points | Slope m | Intercept b | Equation |
|---|---|---|---|
| (1, 2) and (3, 8) | (8 - 2) / (3 - 1) = 3 | 2 - 3 x 1 = -1 | y = 3x - 1 |
| (0, 4) and (8, 0) | (0 - 4) / (8 - 0) = -0.5 | 4 - (-0.5) x 0 = 4 | y = -0.5x + 4 |
| (0, 6) and (4, 6) | (6 - 6) / (4 - 0) = 0 | 6 - 0 x 0 = 6 | y = 6 |
| (2, 3) and (5, 7) | (7 - 3) / (5 - 2) = 4 / 3 | 3 - 1.333333 x 2 = 0.333333 | y = 1.333333x + 0.333333 |
The second row is the one that trips people. The point (0, 4) sits on the y axis, so the intercept is 4 by inspection, and the slope is negative because y drops as x grows. The line falls half a unit for each unit right.
The third row is a horizontal line. Both y values are 6, so the numerator of the slope is zero and m is zero. A slope of zero means no rise at all, and the equation collapses to y = 6, which is a complete description of the line.
The fourth row produces a fraction. The slope is 4/3, which the calculator prints as 1.333333, and the intercept is 1/3, printed as 0.333333. Rounding to six places is a display choice; the exact line is y = (4/3)x + 1/3, and if you need exact answers for a proof, keep the fractions and use the calculator only as a check.
Notice that the point with x of 0 hands you the intercept for free in rows two and three. Whenever a pair includes a point on the y axis, skip the formula for b and read the value off the coordinate.
Horizontal, vertical and other special slopes
Four shapes cover most of the special cases, and each has a signature in the numbers.
| Line | Slope m | Example | What it looks like |
|---|---|---|---|
| Horizontal | 0 | y = 6 | Flat, same y everywhere, crosses the y axis at 6 |
| Vertical | undefined | x = 3 | Straight up and down, no y intercept unless it is the y axis itself |
| Rising at 45 degrees | 1 | y = x + 2 | Rises one unit per unit right, prints as x rather than 1x |
| Falling at 45 degrees | -1 | y = -x + 5 | Falls one unit per unit right, prints as -x |
A vertical line is the only case with no slope intercept form, and the reason sits in the formula: the run x2 - x1 is zero, and division by zero has no value. Software that returns a huge number or infinity for that case is reporting a failure, not a slope. The honest statement is that the line is x = 3, which says every point on it has an x coordinate of 3 and puts no restriction on y.
Slopes of 1 and -1 are worth recognizing because they produce the diagonal lines that show up in textbook sketches. A slope of 1 means the rise equals the run, so the line makes a 45 degree angle with the horizontal axis when the two axes are drawn to the same scale. The tidy printer drops the 1 in front of x for exactly this reason: y = x + 2 reads better than y = 1x + 2 and means the same thing.
Steepness scales with the size of m, and the sign carries the direction. A slope of 10 is steep and rising, a slope of -0.1 is nearly flat and falling, and a slope of 0 is flat. That single number answers the question a graph raises at a glance.
Converting other forms to slope intercept form
Lines arrive written in several forms, and each converts with algebra rather than with a new formula.
Point slope form is y - y1 = m (x - x1), which is the form you get after computing a slope and keeping one point. Expand the right side and move y1 across, and slope intercept form falls out: y = m x + (y1 - m x x1), where the bracket is exactly b. With m of 2 and the point (1, 3), the bracket is 3 - 2 x 1 = 1, so the line is y = 2x + 1, the same result the two point route gives.
Standard form is a x + b y = c, with different letters doing different jobs, which is a common source of confusion. Solve it for y instead of memorizing a conversion: from 2x + 4y = 12, subtract 2x to get 4y = 12 - 2x, then divide every term by 4 to reach y = -0.5x + 3. The slope is -0.5 and the intercept is 3, and both can be checked by plugging in x of 0 and x of 2.
Two warnings come with these conversions. First, the b in standard form is not the b in slope intercept form, so copying it across is wrong. Second, dividing by the coefficient of y flips signs when that coefficient is negative: from 3x - y = 6, the rearrangement gives y = 3x - 6, and a missed sign there turns a rising line into a falling one.
If a line is given as a graph rather than as an equation, read two clear points off the grid, then run the same two formulas. The NASA Glenn slopes lesson walks through reading slope from plotted data, and the Khan Academy algebra library covers the rearrangements step by step.
Mistakes to check before you trust the answer
Most wrong equations come from four slips, and each leaves a visible fingerprint.
| Slip | What it looks like | Repair |
|---|---|---|
| Subtracting x values in one order and y values in the other | A slope with the right size and the wrong sign | Subtract second minus first on both lines |
| Reading b as the slope | An equation whose steepness matches the intercept | m is steepness, b is the crossing height |
| Dropping the sign of b | y = 3x + 1 in place of y = 3x - 1 | Carry the sign into the printed equation |
| Dividing by a zero run | A slope of infinity for a vertical line | Report the line as x = a constant |
The sign slip is the one to hunt for first, because it survives a casual check. A quick test: pick the point with the larger x and see whether the line should be higher or lower there. For (1, 3) and (5, 11) the second point is higher, so the slope must be positive. If the formula hands back a negative number, the subtraction order was mixed.
A second test catches the intercept: plug x of 0 into the finished equation and confirm the result matches b, then plug in one of the original points and confirm the equation reproduces it. Two substitutions take a few seconds and catch nearly every arithmetic error.
A third test catches scale problems. If a line through (0, 1) and (1, 3) comes back with a slope of 0.5, the run and rise were swapped somewhere. Sketching the two points on scratch paper makes the expected steepness obvious before any formula runs, and the sketch costs less time than tracking down a wrong equation later.
Frequently asked questions
What is slope intercept form?
An equation written as y = m x + b, where m is the slope and b is the y intercept. Every non vertical straight line has exactly one equation in this form.
How do you find the slope from two points?
Subtract the y values and divide by the difference of the x values: m = (y2 - y1) / (x2 - x1). For (1, 3) and (5, 11) that is 8 / 4 = 2.
How do you find the y intercept from two points?
Put the slope and either point into b = y1 - m x x1. With m of 2 and the point (1, 3), b = 3 - 2 x 1 = 1, so the line crosses the y axis at (0, 1).
What is the slope of a horizontal line?
Zero. A line through (0, 6) and (4, 6) has a rise of zero, so its equation is y = 6 and it never climbs or falls.
Why does a vertical line have no slope?
Both points share the same x value, so the run in the denominator is zero and the division has no answer. A vertical line is written as x = 3 rather than in slope intercept form.
What does the calculator return for (1, 3) and (5, 11)?
A slope of 2, an intercept of 1 and the equation y = 2x + 1. The second point checks out, since 2 x 5 + 1 = 11.
How is slope intercept form different from point slope form?
Point slope form is y - y1 = m (x - x1) and keeps one point visible. Expanding it and collecting terms gives y = m x + b, with the intercept equal to y1 - m x x1.
How do you convert 2x + 4y = 12 to slope intercept form?
Solve for y. Subtract 2x from both sides to get 4y = 12 - 2x, then divide by 4, which gives y = -0.5x + 3. The slope is -0.5 and the intercept is 3.
What does a slope of 1 look like?
The line rises one unit for every unit it moves right, so it sits at 45 degrees when both axes share a scale. An example is y = x + 2, which passes through (0, 2) and (1, 3).
Can the slope be a decimal or a fraction?
Yes. A slope of 4/3 appears as 1.333333 in the calculator, and a slope of -0.5 is exact. The calculator prints six decimal places, which is plenty for reading a graph.
Do the points have to be integers?
No. Any two distinct points work, including decimals and negatives. Only the case of two identical points fails, because a single point does not define a line.
When is b obvious without any arithmetic?
When one of the points has an x value of zero. That point sits on the y axis, so its y value is b directly, as with (0, 4), which gives an intercept of 4.
Can two different lines share the same intercept?
Yes. Lines with different slopes cross the y axis at the same place, so y = 2x + 1 and y = -3x + 1 both pass through (0, 1) and then separate.
Spotted a wrong number or a broken result?
More Math tools
Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.