Skip to content

Slope Calculator

Find the slope of a line from two points, from rise and run, from a point and an angle or grade, or from its equation. Get the slope as a fraction, decimal, angle and percent grade, plus the distance, midpoint, the line's equation in every form, its intercepts and a graph, with every step shown.

Parallel and perpendicular lines, y at any x, points along the line, units
What do you know?
Point 1
Point 2

Whole numbers, decimals and fractions all work: 3, −2.5, 3/4 or 1 1/2.

Changing the unit converts the four numbers above. The slope stays the same; the distance gets a unit.

Extras
ResultUpdates as you type—Slope m—Angle from level—Percent grade—Distance—Midpoint—Rise : runWorking

    How your slope is worked out

    Your points: rise over run, then the line through them.

    1. 1

      Find the rise

      y₂ − y₁8 − 2= 6

    2. 2

      Find the run

      x₂ − x₁4 − 1= 3

    3. 3

      Divide

      m = rise ÷ run6 ÷ 3m = 2

    4. 4

      Angle and line

      63.43° · 200%y = 2x

    Read more: the formulas, worked examples and typical slopes

    The slope (or gradient) of a line says how steep it is: how far it goes up for every 1 step across. It is the same everywhere along a straight line, so any two points on the line give the same answer. Slopes are written as a number m (maths), an angle in degrees, a percent grade (roads and ramps), a ratio 1 : x (ramps and railways) or a pitch x/12 (roofs).

    The formula

    Slope m = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁)
    Angle = tan⁻¹(m) · Percent grade = m × 100 · Ratio = 1 : (1 ÷ m) · Pitch = 12 × m in 12
    Distance = √((x₂ − x₁)² + (y₂ − y₁)²) · Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
    Slope-intercept form: y = mx + b, where b = y₁ − m × x₁
    Point-slope form: y − y₁ = m(x − x₁) · Standard form: Ax + By = C, slope = −A ÷ B
    Parallel: same m · Perpendicular: −1 ÷ m · Distance from (p, q) to Ax + By = C: |Ap + Bq − C| ÷ √(A² + B²)

    Worked example

    For the default points (1, 2) and (4, 8): the rise is 8 − 2 = 6 and the run is 4 − 1 = 3, so the slope is m = 6 ÷ 3 = 2. The angle is tan⁻¹(2) ≈ 63.43° and the grade is 2 × 100 = 200%. Putting (1, 2) into y = mx + b: 2 = 2 × 1 + b, so b = 0 and the line is y = 2x (point-slope y − 2 = 2(x − 1), standard 2x − y = 0). It crosses both axes at (0, 0). The distance between the points is √(3² + 6²) = √45 = 3√5 ≈ 6.7082, and the midpoint is ((1 + 4) ÷ 2, (2 + 8) ÷ 2) = (2.5, 5).

    Rise and run: a ramp that rises 1 inch for every 12 inches has a slope of 1/12 ≈ 0.0833, a grade of 8.33% and an angle of tan⁻¹(1/12) ≈ 4.76°. Rising 50 cm over 2 m is 0.5 ÷ 2 = 1/4, a 25% grade.

    From an equation: 2x + 3y = 6 → 3y = −2x + 6 → y = −(2/3)x + 2. The slope is −2/3 (falling), the y-intercept is (0, 2) and the x-intercept is (3, 0).

    How steep is that? (typical slopes)

    Example (typical)GradeAngleSlope
    Main-line railway, steep section2%1.15°1/50
    Aircraft approach glide path (3°)5.24%3°0.0524
    Steep motorway or highway hill6%3.43°3/50
    Wheelchair ramp, steepest usually allowed (1 : 12)8.33%4.76°1/12
    Steep city street15%8.53°3/20
    Baldwin Street, New Zealand, among the steepest streetsabout 35%19.3°0.35
    Roof at 6/12 pitch50%26.57°1/2
    House stairs (18 cm rise, 28 cm going)64%32.7°9/14
    45° slope100%45°1

    Notes

    • The typical figures are rough guides only. Ramp, road and stair limits are set by each country's own rules (for example the US ADA and the UK Building Regulations both use 1 : 12 for many ramps), so check the rules where you are before you build.
    • Grade is not the same as angle: a 100% grade is 45°, not 90°. A vertical wall has no grade at all (the slope is undefined).
    • Answers are exact fractions where the inputs are exact. A slope worked out from an angle uses tan, so it is a rounded decimal.
    • Road signs give grades along the road surface or the map distance; over short distances the difference is tiny for normal road slopes.

    Common questions

    How do you find the slope from two points?

    Take the change in y (the rise) and divide it by the change in x (the run): m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (1, 2) and (4, 8) the rise is 8 − 2 = 6 and the run is 4 − 1 = 3, so the slope is 6 ÷ 3 = 2. The line goes up 2 for every 1 across.

    What does a negative, zero or undefined slope mean?

    A positive slope rises from left to right and a negative slope falls. A slope of 0 is a flat, horizontal line such as y = 1. When the two points have the same x, the run is 0 and you would divide by 0, so a vertical line such as x = 3 has an undefined slope.

    How do you turn a slope into an angle or a percent grade?

    The angle is the inverse tangent of the slope: a slope of 2 is tan⁻¹(2) ≈ 63.43°. The percent grade is the slope times 100, so a slope of 1/12 is 8.33%. A 45° angle is a slope of 1, or a 100% grade, where the rise equals the run.

    What is the equation of a line through two points?

    Work out the slope m, then put one point into y = mx + b to find b. For (1, 2) and (4, 8), m = 2, and 2 = 2 × 1 + b gives b = 0, so the line is y = 2x. In point-slope form it is y − 2 = 2(x − 1), and in standard form 2x − y = 0.

    What are the slopes of parallel and perpendicular lines?

    Parallel lines have the same slope. A perpendicular line has the negative reciprocal slope: flip the fraction and change the sign. So a line with slope −2/3 has perpendicular lines with slope 3/2. Multiplying the two slopes always gives −1, except for a flat line, whose perpendicular is vertical.

    Related calculators

    Roof Pitch CalculatorRoof pitch from rise and run, span or angle as x/12, degrees, percent and 1:x, with rafter length, cut angles, hip rafter, roof area and minimum pitch by material.Pythagorean theorem calculatorSolve a right triangle from any two of the sides, angles, area, perimeter or height, with exact square roots, steps and a drawing, plus box diagonals, the 3-4-5 corner check and triples.Graphing calculatorPlot up to 6 graphs with pan and zoom, trace, roots, turning points and intersections, plus parametric, polar, inequalities, sliders and a table.Triangle calculatorSolve any triangle from SSS, SAS, ASA, AAS or SSA (both answers when two fit), right triangles by Pythagoras, or three points, with a drawing and the working.

    Made by Zulu Calculator, part of AlphaZulu LLC. Formulas are shown in full and rule figures are checked against official sources; see how we build calculators.

    Embed this calculator on your site

    Free to use on your website or blog. Paste this code where you want the calculator to appear. Please keep the credit link.

    Slope calculator by Zulu Calculator ↗