Skip to the calculator
SwiftSums
Math & statistics

Slope Calculator. Plus the line's equation.

Gradient between two points, plus the y-intercept and full equation of the line through them.

Live calculation

What's the slope?

Slope (m) 3
y-intercept (b)
− 1
Equation
y = 3x − 1

Your figures are kept on this device only.

How it works

Slope is "rise over run" — how much y changes for each step in x — measured between two points on a line. Once you have the slope, the y-intercept and the full equation follow directly.

m = (y₂ − y₁) ÷ (x₂ − x₁)
b = y₁ − m × x₁
y = mx + b

Worked example

The line through (1, 2) and (4, 11).

Step by step
  1. Rise over run: (11 − 2) ÷ (4 − 1) = 9 ÷ 3.
  2. That gives a slope of 3.
  3. y-intercept: 2 − 3 × 1 = −1.

The equation of the line is y = 3x − 1.

Common questions

What does a slope of zero mean?

The line is perfectly horizontal — y stays the same no matter what x is. Enter two points with the same y-value to see it.

What if both points have the same x-value?

The line is vertical, and slope is undefined — you'd be dividing by zero. A vertical line's equation is simply x = (that shared x-value), which the calculator shows instead of a slope.

What does a negative slope mean?

The line runs downhill left to right — y decreases as x increases. The steeper the negative number, the sharper the downward angle.