CalcTrace

Slope Calculator

Enter two points and get the slope (gradient) of the line through them, its angle and percentage grade, the distance between the points, the midpoint, both intercepts and the equation of the line in three forms. Vertical and horizontal lines are handled, and the line is plotted.

Last updated .

Two points on the line

First point
Second point

Negative and decimal coordinates are fine. Both axes must use the same unit for the angle and distance to mean anything.

Result

Slope (m)

–

Show the working

    The slope formula

    Slope, called gradient in most Australian classrooms, measures how steep a line is: how far it goes up for each unit it goes across. For a line through the points (x₁, y₁) and (x₂, y₂):

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

    Here m is the slope, the rise is the change in y and the run is the change in x. A positive slope climbs from left to right, a negative slope falls, a slope of zero is a horizontal line, and a vertical line has no defined slope because its run is zero. The same two points give several other useful facts:

    Angle: θ = tan⁻¹(m)    Grade = m × 100%

    Distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)

    Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)

    y-intercept: b = y₁ − m × x₁    x-intercept = −b ÷ m

    The angle θ is measured from the horizontal, the grade is the slope written as a percentage, b is where the line crosses the y-axis and the x-intercept is where it crosses the x-axis.

    Worked example

    Find the line through (2, 3) and (6, 11).

    1. Rise and run. Rise = 11 − 3 = 8. Run = 6 − 2 = 4.
    2. Slope. m = 8 ÷ 4 = 2.
    3. Angle and grade. tan⁻¹(2) = 63.43°, and 2 × 100 = 200%.
    4. Distance. √(4² + 8²) = √(16 + 64) = √80 = 8.9443.
    5. Midpoint. ((2 + 6) ÷ 2, (3 + 11) ÷ 2) = (4, 7).
    6. y-intercept. b = 3 − 2 × 2 = −1.
    7. x-intercept. −(−1) ÷ 2 = 0.5.

    Three ways to write the line

    The same line can be written in three standard forms, and each is handy for a different job.

    A vertical line through x = 4 is written simply x = 4. It has no slope-intercept form, because no value of m fits.

    Slope, grade and angle are not the same number

    Road signs and building codes usually quote a percentage grade or a ratio, while a protractor gives an angle, and mixing them up is the most common practical mistake. A grade of 100% is not vertical: it means a rise equal to the run, which is 45°. An 8% road grade is only 4.57°, and a 10% grade is 5.71°. A ramp of 1 in 14 is a grade of 7.14%, or 4.09°. Going the other way, a roof pitched at 22.5° has a grade of 41.42%.

    For small slopes the angle in degrees is roughly 0.57 times the percentage grade, but the two drift apart quickly as the line steepens, so convert with the tangent, not by proportion.

    Common mistakes

    Mixing the order of the points. It does not matter which point is first, as long as you subtract in the same order top and bottom. Taking y₂ − y₁ over x₁ − x₂ flips the sign of the answer.

    Run over rise. Slope is the change in y divided by the change in x. Upside down, the example above would give 0.5 instead of 2.

    Reading a negative slope as an error. The line through (0, 5) and (10, 0) has slope −0.5: it drops half a unit for every unit across, at −26.57° to the horizontal. Measured the way textbooks define the angle of inclination, anticlockwise from the positive x-axis, that same line is at 153.43°. The calculator shows both.

    Two more facts are worth keeping. Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so the two example lines here, with slopes 2 and −0.5, meet at a right angle.