Math

Slope & Intercept Calculator

Every straight line can be written as y = mx + b, where m is the slope (how steeply it rises) and b is the y-intercept (where it crosses the y-axis). Give the calculator two points, or one point plus a slope, and it returns the full equation with the slope in both decimal and fraction form.

Result
—
Slope (m)
—
y-intercept (b)
—
Slope as rise / run
—
x-intercept
—
Equation y = mx + b
—

How to find the equation of a line

Slope-intercept form is y = mx + b, where m is the slope and b the y-intercept. From two points (x₁, y₁) and (x₂, y₂) the slope is the rise over the run:

m = (y₂ − y₁) ÷ (x₂ − x₁)

Then substitute either point back into y − y₁ = m(x − x₁) and solve for b, or shortcut it with b = y₁ − m·x₁. The x-intercept (where the line crosses the x-axis, set y = 0) is −b ÷ m, which is exactly the break-even point in nearly every business or budget problem.

Worked example

Find the line through (2, 3) and (6, 11): m = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2, and b = 3 − 2(2) = −1. So the equation is y = 2x − 1, and the x-intercept is −(−1) ÷ 2 = 0.5. Checking: at x = 6, y = 12 − 1 = 11 ✓. Read as a cost model, this line says "each extra unit costs $2 and there is a $1 fixed offset" — the fixed cost is the intercept, the variable cost is the slope.

What the slope actually tells you

A positive slope means y rises as x rises; a negative slope means it falls. The magnitude is the rate of change: a slope of 0.05 is a gentle 5% climb, a slope of −3 is a steep drop of 3 units per step. A slope of zero gives a horizontal line (b alone), and two points with the same x give a vertical line that cannot be written in slope-intercept form at all — it is simply x = 2, and the calculator flags that case instead of dividing by zero.

Frequently asked questions

1. What do slope and intercept mean?

Slope m is the rate of change — rise over run — and the y-intercept b is the value of y when x = 0, i.e. where the line crosses the vertical axis. Together they describe a straight line completely.

2. How do I find the equation of a line from two points?

Compute the slope m = (y₂ − y₁) ÷ (x₂ − x₁), then b = y₁ − m·x₁, and write y = mx + b. Both steps are automated in the calculator above.

3. What is the x-intercept used for?

Setting y = 0 gives x = −b ÷ m. In practical terms it is the break-even point: the number of units you must sell before revenue exactly covers cost.

4. Why can't a vertical line be written as y = mx + b?

A vertical line has undefined slope because the x values never change, and dividing by zero is not allowed. It is written instead as x = some constant.

Related tools