standarddeviationcalculator.net SD Calculator

How to find the slope of a line

Share this page

Favorites

    No favorites yet. Press Favorite on any page to keep it here.

    The slope of a line is how much y changes when x increases by 1. You can read it from two points, a graph, an equation or a table, and all four give the same number. Divide the change in y (the rise) by the change in x (the run).

    -1012345678-202468101214 (2, 3)(6, 11)
    From (2, 3) to (6, 11) the line rises 8 and runs 4, so the slope is 8 ÷ 4 = 2.

    Method 1. From two points

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

    For (2, 3) and (6, 11), the rise is 11 − 3 = 8 and the run is 6 − 2 = 4, so m = 8 ÷ 4 = 2. The two-point slope calculator does this and also gives the angle and percent grade. For grades as the main figure (roads, ramps, roofs), the percent slope calculator converts both ways.

    Method 2. From a graph

    Pick two points where the line crosses grid corners. Count the squares up (rise) and across to the right (run) from the first to the second. Going down counts as a negative rise. Always move left to right so the run is positive, which keeps the sign of the slope honest.

    Method 3. From an equation

    Rewrite the equation as y = mx + b. The coefficient of x is the slope and b is where the line crosses the y-axis. For 3x + 2y = 12, subtract 3x from both sides and divide by 2 to get y = −1.5x + 6, so the slope is −1.5. An equation already in point-slope form, y − 3 = 2(x − 2), shows its slope of 2 directly.

    Method 4. From a table

    x1234
    y581114

    Take any two columns. From x = 1 to x = 2, y goes from 5 to 8, so m = 3 ÷ 1 = 3. Check a second pair, x = 2 to x = 4, which gives 6 ÷ 2 = 3. If different pairs give different slopes, the table is not a straight line and has no single slope.

    What the sign of the slope tells you

    SlopeThe lineExample
    PositiveRises left to righty = 2x − 1
    NegativeFalls left to righty = −1.5x + 6
    ZeroHorizontaly = 4
    UndefinedVerticalx = 3

    The bigger the absolute value, the steeper the line. Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line with slope 2 is perpendicular to one with slope −½.

    Common mistakes

    • Subtracting in a different order on top and bottom, which flips the sign.
    • Putting run over rise. It is rise over run, y over x.
    • Reading slope from an equation that is not solved for y. In 3x + 2y = 12 the slope is not 3.
    • Calling a vertical line's slope zero. Zero is horizontal. Vertical is undefined.

    If you want the slope of a best-fit line through scattered data instead of two exact points, use the linear regression calculator.

    Common questions

    What is the slope formula?

    m = (y₂ − y₁) ÷ (x₂ − x₁), the change in y divided by the change in x between any two points on the line.

    How do you find the slope from an equation?

    Solve for y. In y = mx + b the number multiplying x is the slope. For 3x + 2y = 12 that gives y = −1.5x + 6, so the slope is −1.5.

    What is the slope of a horizontal or vertical line?

    A horizontal line has slope 0, because y never changes. A vertical line has an undefined slope, because x never changes and the formula divides by zero.

    Does it matter which point I call point 1?

    No, as long as you subtract in the same order on top and bottom. Swapping the points flips the sign of both differences, and the signs cancel.

    Slope from two points: a worked example with its result and chart
    The calculator this article uses, on a worked example of its own.