Given two points, this finds the full slope-intercept equation (y = mx + b) of the line passing through them.
How it works
The slope is the change in y divided by the change in x between the two points; the y-intercept is then found by substituting one point back into the equation and solving for b.
What this does not include
This does not include a road-grade-style rise/run percentage — for that, use this site’s slope percentage calculator instead. This tool produces a full algebraic line equation.
How to use this calculator
- Enter the x and y coordinates of both points.
A worked example
Points (0, 1) and (2, 5): slope = (5−1)/(2−0) = 2, giving y = 2x + 1.
Points (1, 2) and (3, 2): slope = 0, giving the horizontal line y = 2.
What the variables mean
| Variable | Meaning |
|---|---|
| (x1, y1), (x2, y2) | Two points the line passes through |
| Slope, intercept | The m and b values in y = mx + b |
Edge cases worth knowing
A slope of zero produces a horizontal line, not an error — the second example shows this directly, since both points share the same y-value.
Two points sharing the same x-value describe a vertical line, which has no defined slope and can’t be written in y = mx + b form — the calculator declines to show a result for that case.
Frequently asked questions
Why does a vertical line have no answer here?
A vertical line has an undefined slope, since the change in x is zero and division by zero has no meaningful result — vertical lines can’t be written in slope-intercept form at all.
What does a slope of zero mean?
A perfectly horizontal line — y stays the same no matter what x is.
What’s a practical use for this?
Finding a linear equation from two known data points, common in algebra homework and basic trend-line calculations.