Skip to content

Slope Calculator

Find the slope of a line from two points, or from one point and the slope or angle. See the slope as an exact fraction, the equation in slope-intercept, point-slope and standard form, the angle, intercepts and distance, with the working and a graph.

Whole numbers, decimals or fractions such as 3/4 or −1 1/2.

Slope (m)

–

Working

    The line

    Key facts

    Price
    Free, with no sign-up and no usage limits
    Privacy
    Runs in your browser: your files and text are never uploaded
    Works on
    Any current browser on Windows, macOS, Linux, ChromeOS, Android and iPhone
    Made by
    Toolgu
    Last updated

    The slope formula

    The slope m of a line through two points (x₁, y₁) and (x₂, y₂) is the change in y divided by the change in x, often called rise over run:

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

    • A positive slope rises from left to right; a negative slope falls.
    • A slope of 0 is a horizontal line, such as y = 4.
    • A vertical line, such as x = 3, has an undefined slope, because the run is 0 and you can’t divide by 0.
    • The bigger the number, ignoring the sign, the steeper the line. A slope of 1 is a 45° line.

    How to find the slope of a line: an example

    Find the slope of the line through (−2, 3) and (4, −1).

    1. Subtract the y-values: −1 − 3 = −4. That’s the rise.
    2. Subtract the x-values in the same order: 4 − (−2) = 6. That’s the run.
    3. Divide: m = −4 ÷ 6 = −2/3. The line falls 2 units for every 3 to the right.
    4. Find the y-intercept with b = y₁ − m·x₁ = 3 − (−2/3) × (−2) = 5/3.

    So the equation is y = −2/3x + 5/3, or in standard form 2x + 3y = 5. It doesn’t matter which point you call the first, as long as you subtract both coordinates in the same order.

    Three ways to write the equation of a line

    • Slope-intercept form: y = mx + b, where m is the slope and b is where the line crosses the y-axis.
    • Point-slope form: y − y₁ = m(x − x₁), handy when you know one point and the slope.
    • Standard form: Ax + By = C with whole numbers, often used for systems of equations and intercepts.

    Slope as an angle or a grade

    The angle θ a line makes with the x-axis is tan⁻¹(m): a slope of 1 is 45°, a slope of 2 is about 63.4°. Roads, ramps and roofs often give slope as a grade, the rise per 100 of run: a slope of 0.08 is an 8% grade. US accessibility rules allow wheelchair ramps up to 1:12, a slope of about 0.083 or 8.3%.

    Frequently asked questions

    How do you find the slope from two points?

    Subtract the y-values and divide by the difference of the x-values in the same order: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (4, 9) that’s (9 − 2) ÷ (4 − 1) = 7/3.

    What does a slope of 0 or an undefined slope mean?

    A slope of 0 is a flat, horizontal line such as y = 4. A vertical line such as x = 3 has an undefined slope, because the run x₂ − x₁ is zero.

    How do I write the equation of a line from its slope?

    Use y = mx + b. Put in the slope m, then find b from a point on the line: b = y₁ − m·x₁. With slope 3/4 through (2, −1), b = −1 − 3/4 × 2 = −5/2, so y = 3/4x − 5/2.

    How do I convert slope to an angle?

    Take the inverse tangent: angle = tan⁻¹(m). A slope of 1 is 45°, 0.5 is about 26.6° and 2 is about 63.4°. Going the other way, slope = tan(angle).

    Is slope the same as gradient?

    Yes. Slope is the usual word in the US, gradient in the UK and many other countries. On roads, gradient or grade is often given as a percentage: slope × 100.