Slope-Intercept Form Calculator

Find the slope-intercept equation y = mx + b of the line through two points. Also returns slope, distance and midpoint.

How this works

Slope-intercept form is the canonical way to write a non-vertical line in two dimensions: y = mx + b, where m is the slope and b is the y-intercept (where the line crosses the y-axis). Given two points on the line, you can recover both m and b: slope is rise over run, and once you know m, plug either point into the equation and solve for b.

This form is favoured because it makes the line's behaviour immediately readable. m tells you direction and steepness; b tells you where the line "starts" on the y-axis. To graph a line in slope-intercept form, plot the y-intercept as a starting point on the y-axis, then use the slope (rise/run) to step out additional points. To compare two lines, just compare their m and b values: same m means parallel; m·m' = −1 means perpendicular; same m and b means the same line.

Vertical lines (where x is constant) cannot be written in slope-intercept form because the slope is undefined. They're written as x = constant instead. This calculator detects vertical lines and surfaces that form when needed. For other line forms — point-slope (y − y₁ = m(x − x₁)) and standard (Ax + By = C) — you can convert algebraically: any of the three forms describes the same line, just with different conventions for what to highlight.

The formula

y = mx + b slope (m) = (y₂ − y₁) / (x₂ − x₁) y-intercept (b) = y₁ − m·x₁ Vertical line (x₁ = x₂): x = x₁

m is the slope (rise over run between any two points on the line). b is the y-intercept (the y-value when x = 0). Once you know m and b, the equation describes every point on the line: pick any x, compute mx + b, that's the corresponding y.

Example calculation

  • Find y = mx + b through (1, 2) and (4, 8).
  • Slope m = (8 − 2) / (4 − 1) = 2.
  • b = y₁ − m·x₁ = 2 − 2·1 = 0. So y = 2x. Verify with the second point: 2·4 + 0 = 8 ✓.

Frequently asked questions

How is slope-intercept form different from point-slope form?

They're algebraically equivalent — same line, different way of writing it. Slope-intercept form (y = mx + b) makes the y-intercept explicit. Point-slope form (y − y₁ = m(x − x₁)) makes a specific point on the line explicit instead. Use point-slope when you know a point and a slope but haven't computed the intercept yet; use slope-intercept when you want to graph quickly or compare with other lines.

When should I use standard form (Ax + By = C) instead?

Standard form handles vertical lines elegantly (just set B = 0) and is the convention in linear programming, systems of equations, and many introductory algebra textbooks. It's less geometric — you can't read off slope or intercept directly — but it normalises so coefficients are typically integers. Most computational systems convert to standard form internally even if they accept slope-intercept input.

How do I find the equation if I only have one point and the slope?

Plug the point and slope into y = mx + b and solve for b: b = y − mx. For example, with slope m = 3 and point (2, 7): b = 7 − 3·2 = 1, so y = 3x + 1. Verify by plugging the point back in: 3·2 + 1 = 7 ✓. This calculator needs two points, but you can fake the second point by using your known point plus any other point on the same line — pick any x, compute y = mx + b mentally, and use that.

Related calculators