Slope Calculator

Find the slope of a line from two points or a point and slope, with the line equation in three forms, the angle, grade, intercepts and full working.

Slope calculator
Known values
Slope

    Working

    Slope m = (y₂ − y₁) ÷ (x₂ − x₁). Fractions such as 3/4 are accepted. Exact fractions are shown when the inputs are whole numbers or simple fractions.

    On this page

    A slope calculator finds the slope of a line from two points using m = (y₂ − y₁) ÷ (x₂ − x₁), and gives the equation of the line in slope-intercept, point-slope and standard form. It also shows the angle of the line, the grade as a percentage, the distance and midpoint between the points, both intercepts and the perpendicular slope. You can also start from one point and a known slope.

    For example, the line through (1, 2) and (4, 8) has a slope of 2 and the equation y = 2x. The line through (2, 3) and (6, 6) has a slope of 3/4, or 0.75, and the equation y = (3/4)x + 3/2.

    How to use the slope calculator

    1. Choose whether you know two points or one point and the slope.
    2. Enter the coordinates. Whole numbers, decimals and fractions such as 1/2 are all accepted, including negative values.
    3. For the point and slope option, enter the slope as a number or fraction, such as 2 or 3/4.
    4. Press Calculate to see the slope, the equations of the line and the step-by-step working.

    What is slope?

    Slope measures how steep a line is. It’s the ratio of the vertical change, called the rise, to the horizontal change, called the run, between any two points on the line. A slope of 2 means the line goes up 2 units for every 1 unit it moves to the right. A slope of −1/2 means it goes down 1 unit for every 2 units to the right.

    Because a straight line has the same steepness everywhere, any two points on it give the same slope. That’s what makes slope useful: one number describes the direction and steepness of the whole line.

    The slope formula

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

    Here (x₁, y₁) and (x₂, y₂) are two points on the line, and m is the slope. The letter m is the traditional symbol for slope. The order of the points doesn’t matter, as long as you subtract in the same order on the top and the bottom: (y₁ − y₂) ÷ (x₁ − x₂) gives the same answer.

    Types of slope

    SlopeDirection of the lineExample
    PositiveRises from left to righty = 2x
    NegativeFalls from left to righty = −x + 3
    ZeroHorizontaly = 5
    UndefinedVerticalx = 2

    A vertical line has an undefined slope because the run is zero, and dividing by zero is impossible. Its equation is written as x = a constant instead of y = mx + b.

    Worked examples

    Slope from two points

    Find the slope through (2, 3) and (6, 6). The rise is 6 − 3 = 3 and the run is 6 − 2 = 4, so m = 3/4 = 0.75. The distance between the points is √(4² + 3²) = √25 = 5, and the midpoint is (4, 4.5).

    A negative slope

    For (−1, 4) and (3, −4), the rise is −4 − 4 = −8 and the run is 3 − (−1) = 4, so m = −8 ÷ 4 = −2. The line falls 2 units for every unit to the right, and its equation is y = −2x + 2.

    Line from a point and a slope

    A line passes through (2, −3) with slope 3/4. In point-slope form, it’s y + 3 = (3/4)(x − 2). Solving for y gives y = (3/4)x − 9/2, so the y-intercept is −4.5. Multiplying through by 4 gives the standard form 3x − 4y = 18.

    Equations of a line

    • Slope-intercept form: y = mx + b, where b is the y-intercept. It’s the easiest form for graphing.
    • Point-slope form: y − y₁ = m(x − x₁). It’s the quickest form to write when you know one point and the slope.
    • Standard form: Ax + By = C, with whole-number coefficients and A usually positive. It’s handy for finding intercepts and solving systems of equations.

    To find b, substitute a known point into y = mx + b: b = y₁ − m × x₁. For the line through (1, 2) with slope 2, b = 2 − 2 × 1 = 0, so the line passes through the origin.

    Slope, angle and grade

    Slope is closely linked to the angle a line makes with the horizontal. The angle θ satisfies tan θ = m, so θ = arctan(m). A slope of 1 is a 45° angle, a slope of 0.5 is about 26.6°, and a slope of 2 is about 63.4°.

    Engineers and builders often express slope as a grade, which is the slope multiplied by 100 and written as a percentage. A road with an 8% grade rises 8 metres for every 100 metres of horizontal distance, an angle of about 4.6°. Roof pitch is usually written as rise over a run of 12, so a 6/12 roof has a slope of 0.5. Wheelchair ramps are often limited to a slope of 1:12, a grade of about 8.3% or an angle of about 4.8°.

    SlopeGradeAngle
    1/128.33%4.76°
    0.550%26.57°
    1100%45°
    2200%63.43°

    Parallel and perpendicular lines

    Parallel lines have the same slope, so they never meet. Perpendicular lines meet at a right angle, and their slopes are negative reciprocals: if one line has slope m, a perpendicular line has slope −1/m. The product of the two slopes is −1. For example, a line with slope 3/4 is perpendicular to any line with slope −4/3. A horizontal line, with slope 0, is perpendicular to a vertical line.

    Slope as a rate of change

    Outside geometry, slope describes how fast one quantity changes compared with another. On a distance–time graph, the slope is the speed. On a cost graph, it’s the cost per item. If a taxi charges a fixed fee plus a price per kilometre, the price per kilometre is the slope of the line and the fixed fee is the y-intercept. In science, the slope of a line of best fit often gives an important constant, such as the spring constant in a force–extension graph.

    Finding the intercepts

    The y-intercept is where the line crosses the y-axis, at x = 0, and equals b in y = mx + b. The x-intercept is where the line crosses the x-axis, at y = 0. Setting y to zero gives x = −b ÷ m. For y = −2x + 2, the y-intercept is (0, 2) and the x-intercept is (1, 0). A horizontal line other than y = 0 has no x-intercept, because it never meets the x-axis.

    Common mistakes

    • Subtracting in a different order on the top and the bottom, which flips the sign of the slope.
    • Putting the run on top. Slope is always rise over run: change in y divided by change in x.
    • Mixing up a zero slope and an undefined slope. Horizontal lines have slope 0; vertical lines have no slope.
    • Losing a minus sign when one of the coordinates is negative. Use brackets: 3 − (−1) = 4.
    • Assuming the angle in degrees equals the slope. A slope of 1 is 45°, not 1°.

    Tips for working with slope

    • Sketch the two points first. If the line goes up to the right, the slope should be positive.
    • Leave the slope as a fraction when you can. Fractions are exact and make the rise and run easy to see.
    • Check your equation by substituting both points into it; each should make it true.
    • Use the perpendicular slope to find the line at a right angle through a point.

    Related calculations

    Two other tools work well alongside this one: the quadratic formula calculator, to solve quadratic equations, and the distance calculator, to find the distance between two points.

    Frequently asked questions

    Subtract the y-values and divide by the difference of the x-values: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (4, 8), m = 6 ÷ 3 = 2.

    The line is horizontal. The y-value stays the same as x changes, so the equation has the form y = a constant.

    A vertical line has an undefined slope because the run is zero and you can't divide by zero. Its equation is x = a constant.

    Take the arctangent: angle = arctan(m). A slope of 1 gives 45°, and a slope of 0.5 gives about 26.6°.

    The negative reciprocal, −1/m. A line with slope 2 is perpendicular to lines with slope −1/2.

    Find the slope m, then the y-intercept b = y₁ − m × x₁, and write y = mx + b. The calculator does both steps for you.

    No, as long as you subtract in the same order on the top and the bottom. Both orders give the same slope.

    Grade is the slope written as a percentage. A slope of 0.08 is an 8% grade.

    The slope is 3, the number in front of x. The y-intercept is 5.

    Yes. Enter values such as 1/2 or −3/4. The calculator shows exact fractional slopes and equations where possible.

    It means one quantity falls as the other rises, such as the value of a car going down as its age goes up.

    It sets roof pitch, drainage falls, ramp steepness and road grades, usually written as a ratio or a percentage.