📈 Slope Intercept Form Calculator
By ToolNimba Math Team · Updated 2026-06-19
- Enter two points to see the working.
Slope m = (y2 - y1) / (x2 - x1), then b = y1 - m·x1.
This slope intercept calculator turns two points into the equation of a straight line in y = mx + b form. Enter the coordinates of any two points and it returns the slope (m), the y-intercept (b), and the finished equation, along with the step-by-step working so you can follow how each number was found. It also handles the awkward cases, a horizontal line (slope 0) and a vertical line (undefined slope), without breaking.
What is the Slope Intercept Calculator?
Slope-intercept form is the most common way to write a straight line: y = mx + b. Here m is the slope, which tells you how steeply the line rises or falls, and b is the y-intercept, the y value where the line crosses the vertical axis (the point where x = 0). Once you know m and b you can sketch the line instantly, read off its direction, and predict the y value for any x. That is why this form shows up everywhere from algebra homework to trend lines in spreadsheets.
To build the equation from two points you only need two steps. First find the slope with m = (y2 - y1) / (x2 - x1), the change in y (the rise) divided by the change in x (the run). Then find the intercept by rearranging the line equation: since y1 = m·x1 + b, you get b = y1 - m·x1. Substituting either of your two points gives the same b, so you can use whichever point is easier. Plug m and b back into y = mx + b and you are done.
Two special cases deserve attention. If the two points share the same y value, the slope is 0 and the line is horizontal: the equation collapses to y = b, a flat line. If the two points share the same x value, the run (x2 - x1) is zero, so the slope is undefined and the line is vertical. A vertical line cannot be written as y = mx + b at all, it is written x = a instead. This calculator detects both situations and tells you what is happening rather than returning a meaningless number.
When to use it
- Finding the equation of a line for algebra or geometry homework when you are given two points.
- Working out a trend line by hand from two data readings, for example two timestamps and two meter values.
- Checking a graphing answer: confirm the slope and y-intercept before you plot the line.
- Converting a pair of points into y = mx + b so you can predict the y value at any other x.
How to use the Slope Intercept Calculator
- Enter the x and y coordinates of your first point (x1, y1).
- Enter the x and y coordinates of your second point (x2, y2).
- Read off the slope (m), the y-intercept (b), and the full y = mx + b equation.
- Expand the step-by-step panel to see exactly how m and b were calculated.
Formula & method
Worked examples
Find the line through the points (1, 2) and (3, 8).
- m = (y2 - y1) / (x2 - x1) = (8 - 2) / (3 - 1)
- m = 6 / 2 = 3
- b = y1 - m·x1 = 2 - (3)(1) = 2 - 3 = -1
- Equation: y = 3x - 1
- Check with the second point: 3 × 3 - 1 = 8, which matches y2.
Result: y = 3x - 1 (slope 3, y-intercept -1)
Find the line through (-2, 5) and (2, -3).
- m = (-3 - 5) / (2 - (-2)) = -8 / 4 = -2
- b = y1 - m·x1 = 5 - (-2)(-2) = 5 - 4 = 1
- Equation: y = -2x + 1
- Check: -2 × 2 + 1 = -3, which matches the second point.
Result: y = -2x + 1 (slope -2, y-intercept 1)
Find the line through (0, 4) and (5, 4), where both y values match.
- m = (4 - 4) / (5 - 0) = 0 / 5 = 0
- b = y1 - m·x1 = 4 - (0)(0) = 4
- A slope of 0 means the line is flat.
- Equation: y = 4 (a horizontal line).
Result: y = 4 (horizontal line, slope 0, y-intercept 4)
What the slope value tells you about the line
| Slope (m) | Line direction | Example equation |
|---|---|---|
| Positive (m > 0) | Rises left to right | y = 3x - 1 |
| Negative (m < 0) | Falls left to right | y = -2x + 1 |
| Zero (m = 0) | Horizontal (flat) | y = 4 |
| Undefined | Vertical line | x = 3 |
The parts of slope-intercept form y = mx + b
| Symbol | Name | Meaning |
|---|---|---|
| m | Slope | Rise over run: how much y changes per unit increase in x |
| b | Y-intercept | The y value where the line crosses the y-axis (x = 0) |
| x | Independent variable | The input you choose |
| y | Dependent variable | The output the line produces for that x |
Common mistakes to avoid
- Computing rise over run upside down. The slope is the change in y divided by the change in x, not the other way around. Putting the x difference on top gives the reciprocal slope and a wrong line. Keep it as (y2 - y1) / (x2 - x1).
- Subtracting the coordinates in a different order on top and bottom. If you do y2 - y1 on top you must do x2 - x1 (same order) on the bottom. Mixing the order, such as y2 - y1 over x1 - x2, flips the sign of the slope.
- Treating a vertical line as y = mx + b. When the two points share the same x value the run is zero and the slope is undefined. There is no y = mx + b form for a vertical line; it is written x = a instead.
- Forgetting the sign when finding b. The intercept is b = y1 - m·x1. With a negative point or a negative slope the subtraction of a negative becomes an addition, so track the signs carefully, for example 5 - (-2)(-2) = 5 - 4 = 1.
Glossary
- Slope (m)
- A measure of steepness equal to the rise (change in y) divided by the run (change in x) between any two points on the line.
- Y-intercept (b)
- The y value where the line crosses the vertical axis, that is, the value of y when x = 0.
- X-intercept
- The x value where the line crosses the horizontal axis, found by setting y = 0 and solving x = -b / m.
- Slope-intercept form
- The equation y = mx + b, which states a line directly in terms of its slope m and y-intercept b.
- Rise over run
- A plain-language description of slope: how far the line goes up or down (rise) for each step across (run).
Frequently asked questions
How do I find slope-intercept form from two points?
First find the slope with m = (y2 - y1) / (x2 - x1). Then find the y-intercept with b = y1 - m·x1, using either point. Finally write the line as y = mx + b. This calculator does all three steps and shows the working.
What is the slope-intercept form of a line?
Slope-intercept form is y = mx + b, where m is the slope (steepness and direction) and b is the y-intercept (where the line crosses the y-axis). It is the most common way to write a straight line because you can read its key features straight from the equation.
What does the b in y = mx + b mean?
The b is the y-intercept: the value of y when x = 0, which is exactly where the line crosses the vertical axis. If b is positive the line crosses above the origin, and if b is negative it crosses below.
What if the two points have the same x value?
Then the run (x2 - x1) is zero, so the slope is undefined and the line is vertical. A vertical line cannot be written as y = mx + b; it is written as x = a, where a is that shared x value. The calculator detects this and reports x = a instead.
What does a slope of zero mean?
A slope of zero means the line is perfectly horizontal: y never changes as x changes. The equation simplifies to y = b. This happens whenever your two points share the same y value.
How do I find the x-intercept from y = mx + b?
Set y = 0 and solve for x, which gives x = -b / m. A horizontal line (m = 0) above or below the axis has no x-intercept, while a horizontal line on the axis is the x-axis itself.