Slope-Intercept Calculator
Find slope m and y-intercept b for a line through two points. Enter (x1,y1) and (x2,y2) to get y=mx+b. Vertical lines (x1=x2) are guarded and return zero.
How to use this tool
- Enter x1, y1, x2 and y2 in the fields above.
- Results update instantly as you type — or click Calculate.
- Read your slope (m) and the full breakdown beneath it.
Formula
m = (y2-y1)/(x2-x1); b = y1 - m*x1
How it works
Compute slope m = (y2−y1)/(x2−x1), then b = y1 − m·x1 for the y-intercept.
Worked example
Points (0,1) and (3,7)
- m = (7-1)/(3-0) = 2
- b = 1 - 2(0) = 1
- Line: y = 2x + 1
Common mistakes to avoid
- Entering the same x-value for both points (a vertical line), which makes the denominator zero and the slope undefined.
- Subtracting y and x in opposite orders, e.g. (y2-y1)/(x1-x2), flipping the sign of the slope.
- Confusing the y-intercept b with the point y1; b is the y value at x=0, not at x1.
Key terms
Frequently asked questions
- What if my two points have the same y-value?
- A horizontal line has slope m=0 and the equation simplifies to y = b, where b equals the common y-value.
- How do I find the x-intercept from the result?
- Set y=0 in y=mx+b and solve: x = -b/m (provided m is not zero).
- Can I enter decimal coordinates?
- Yes. The calculator accepts any real number for x1, y1, x2, y2, including decimals and negative values.