Slope Calculator

Slope (m)
Next

Give the calculator two points and it returns the slope of the line through them (rise over run), the y-intercept, and the slope-intercept equation y = mx + b. Useful for geometry homework, field surveying estimates, and quickly checking the grade of a roof or ramp. The reference tables below explain how a slope value maps to an angle, a road grade, or a roof pitch, since those often matter more than the raw number.

How slope is computed

  1. 1

    Enter two points

    (x1, y1) and (x2, y2). The order matters only for sign conventions: swap them and you get the same line.

  2. 2

    Slope = rise over run

    m = (y2 - y1) / (x2 - x1). A zero denominator means the line is vertical (undefined slope).

  3. 3

    Y-intercept

    b = y1 - m * x1, the value where the line crosses the y-axis. The calculator shows this as b.

  4. 4

    Line equation

    Slope-intercept form y = mx + b, built from the slope and the y-intercept above.

What slope tells you

Slope value Direction Example angle
m > 0 Rises left-to-right 45 deg at m=1
m = 0 Horizontal 0 deg
m < 0 Falls left-to-right -45 deg at m=-1
m undefined Vertical 90 deg
m = 1

Practical slope / grade

Context How slope is expressed
Road grade Percent (slope x 100). 6% grade = slope 0.06
Roof pitch Ratio (rise:12 run), e.g. 4:12
ADA ramp 1:12 max (8.33%)
Ski trail Degrees, typically 15-35 deg
Playground slide Around 30-40 deg

Roof pitch 4:12 means 4 units of rise for every 12 units of run, slope 0.333 and roughly 18.4 degrees. A 100% road grade is not vertical; it is 45 degrees. 200% grade is roughly 63 degrees.

Common mistakes

  • Dividing run by rise. The formula is rise over run, not the other way around. Double-check when you get a weird answer.
  • Sign errors with negative coordinates. (−3, 4) to (1, −2): rise = −2 − 4 = −6, run = 1 − (−3) = 4, slope = −1.5. The double-negative on the run is the usual stumble.
  • Vertical lines. A vertical line has an undefined slope. Equation is x = k, not y = mx + b.
  • Confusing slope with angle. An 8% grade is roughly 4.6 degrees, not 8 degrees. Slope x 100 gives percent; arctan gives angle.

Point-slope form

Given one point (x0, y0) and slope m: y − y0 = m(x − x0). Expanding gives y = mx + (y0 − m * x0), so the y-intercept is b = y0 − m * x0.

Frequently Asked Questions

There is no unique line through a single point, the slope is indeterminate. Pick two distinct points.

Rearrange to y = mx + b form; the coefficient of x is the slope. For Ax + By = C, slope = -A/B.

Yes, a horizontal line has slope 0. That is different from an undefined slope (vertical line), which is not the same thing.

No, 3D lines are described by direction vectors, not a single slope. For 2D projections (looking down the z-axis) you can use 2D slope on the x-y pair.

Related Tools

Tool available in other languages