Skip to content
Calc.
mathBy Emil BjörkSeptember 23, 2026

Slope Calculator: How to Find the Slope of a Line

The slope of a line is the vertical change divided by the horizontal change between any two of its points: rise over run. It tells you how steep the line is and whether it goes up or down from left to right. This guide shows the formula with worked examples, what each kind of slope means, where slope shows up outside the classroom, and the mistakes that produce wrong answers. The Slope Calculator takes the coordinates of two points and returns the slope.

The Slope Formula

For two points (x₁, y₁) and (x₂, y₂):

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

The numerator is the rise (change in y) and the denominator is the run (change in x).

Example. Points (2, 3) and (6, 11):

  • Rise: 11 − 3 = 8
  • Run: 6 − 2 = 4
  • Slope: 8 ÷ 4 = 2

For every 1 unit moved to the right, the line rises 2 units. Which point you call "first" doesn't matter as long as you are consistent: (3 − 11) ÷ (2 − 6) = −8 ÷ −4 = 2 as well.

The Four Kinds of Slope

Positive: the line rises from left to right; y increases as x increases. The example above has slope 2.

Negative: the line falls from left to right. Points (1, 8) and (5, 0) give (0 − 8) ÷ (5 − 1) = −8 ÷ 4 = −2.

Zero: a horizontal line; y never changes. Points (3, 7) and (9, 7) give (7 − 7) ÷ (9 − 3) = 0 ÷ 6 = 0.

Undefined: a vertical line; x never changes, so the run is zero and the formula divides by zero. Points (4, 1) and (4, 9) have no defined slope. No number describes this case, and the calculator says so ("Undefined slope: the line is vertical"); a vertical line is simply x = 4.

Slope in the Real World

Rates of change. A slope is a rate: units of y per unit of x. If a stock moves from $50 to $65 over 5 trading days, the slope of the line through those points is 15 ÷ 5 = 3 dollars per day. If a temperature reads 68°F at 9 AM and 84°F at 2 PM, the points (9, 68) and (14, 84) give a slope of 16 ÷ 5 = 3.2 degrees per hour.

Ramps and grades. Building codes limit slope directly. The ADA Standards for Accessible Design cap the running slope of a ramp at 1:12 (1 unit of rise per 12 units of run, about 0.083, or 8.3%).

Trend lines in data. When you fit a straight line to a set of points rather than drawing it through two of them, the fitted slope says how much y changes per unit of x on average; the linear regression slope calculator computes it from the sums of paired data (n, Σx, Σy, Σxy and Σx²).

Using the Slope Calculator

Enter x₁ and y₁ for the first point and x₂ and y₂ for the second. The calculator applies (y₂ − y₁) ÷ (x₂ − x₁) and returns the slope as a decimal; 8 ÷ 4 returns 2, and −8 ÷ 4 returns −2. For the temperature example, entering (9, 68) and (14, 84) returns 3.2.

Once you have the slope m and one point, the line's equation is y − y₁ = m(x − x₁). Rearranged as y = mx + b, the intercept is b = y₁ − m·x₁, and the line crosses the x-axis where mx + b = 0, at x = −b ÷ m. For the first example, b = 3 − 2 × 2 = −1, so the line is y = 2x − 1 and it crosses the x-axis at x = 0.5.

Common Mistakes

  • Mixing the order. Subtract in the same order in both numerator and denominator. (y₂ − y₁) over (x₁ − x₂) flips the sign.
  • Sign errors with negative coordinates. For (−3, −1) and (2, −6): (−6 − (−1)) ÷ (2 − (−3)) = (−6 + 1) ÷ 5 = −5 ÷ 5 = −1. Write out the double negatives.
  • Putting run over rise. Slope is Δy ÷ Δx, not the reverse.
  • Forgetting the units. A slope of 0.5 means something different for test scores per study hour than for dollars per day; carry the units with the number.

Sources

Related articles

Looking for a calculator?

Calculator Collection has 1,800+ free calculators. Browse all calculators →