Slope Calculator

Use the slope calculator to find the slope, y-intercept, equation and distance between two points, with every step shown.

Free · No sign-up · Steps shown

Last updated

What you get

  • The slope from any two points
  • The y-intercept and y = mx + b
  • The distance between the points
  • Vertical and flat lines handled

Jump to a guide

Slope Calculator

Point 1

Point 2

m = 2
Slope of the line through (2, 3) and (6, 11)
y = 2x - 1
Show the steps

    What Is a Slope Calculator?

    A slope calculator on CalcSolver finds the slope of a straight line from two points and shows the full working. You enter two points, such as (2, 3) and (6, 11), and it returns the slope, the y-intercept, the equation of the line, and the distance between the points. Every step is shown, so you can follow the math and check your own homework.

    The calculator uses the slope formula, which divides the change in y by the change in x. It also handles the two special cases: vertical lines, where the slope is undefined, and horizontal lines, where the slope is 0. Negative numbers and decimals are allowed, and answers are rounded to two decimal places.

    The Slope Formula

    The slope formula finds the slope m of the line through two points (x1, y1) and (x2, y2). It is: m = (y2 − y1) ÷ (x2 − x1). The top of the fraction is the rise, the change in y. The bottom is the run, the change in x. Subtract the y values, subtract the x values, then divide.

    Here is the formula in action with the points (2, 3) and (6, 11). Label the first point (x1, y1) = (2, 3) and the second point (x2, y2) = (6, 11).

    1. Find the rise: y2 − y1 = 11 − 3 = 8.
    2. Find the run: x2 − x1 = 6 − 2 = 4.
    3. Divide rise by run: m = 8 ÷ 4 = 2.
    4. The slope is 2, so the line rises 2 units for every 1 unit it moves right.

    The slope does not have to be a whole number. For the points (1, 2) and (4, 6), the rise is 4 and the run is 3, so the slope is 4/3, or about 1.33. Teachers often prefer the exact fraction 4/3, because the decimal is rounded. The fraction calculator works with slopes like 4/3 in exact form, instead of rounding them to a decimal.

    One line to remember: slope is rise over run, and the formula turns two points into one number.

    What Is Slope?

    Slope is a number that tells you how steep a line is, and which way it leans. A line with a large slope climbs fast. A line with a small slope climbs slowly. A line with a slope of 0 is flat, and a line that goes downhill has a negative slope.

    The idea behind slope is simple: it compares how far you move up or down with how far you move across. That is why slope is often described as rise over run. The rise is the vertical change, and the run is the horizontal change. If you move 4 units to the right and 8 units up, the rise is 8, the run is 4, and the slope is 8 divided by 4, which is 2.

    Slope has a plain meaning on a graph. A slope of 2 means the line rises 2 units for every 1 unit it moves to the right. A slope of 0.5 means it rises only half a unit per unit right, so it looks gentle. A slope of 10 rises 10 units per unit right, so it looks almost vertical. The further the slope is from 0, in either direction, the steeper the line: a slope of −10 is just as steep as 10, but it falls instead of climbing.

    Finding the Y-Intercept and the Equation

    Once you know the slope, you can write the full equation of the line. Most lines are written in slope-intercept form: y = mx + b. In this form, m is the slope and b is the y-intercept, the value of y where the line crosses the y-axis, at x = 0.

    To find b, put the slope and one of your points into y = mx + b and solve for b. Using the example above, the slope is 2 and the point (2, 3) is on the line. Put x = 2 and y = 3 into the equation: 3 = 2 × 2 + b. That gives 3 = 4 + b, so b = 3 − 4 = −1. The y-intercept is −1, which means the line crosses the y-axis at (0, −1).

    Now put m = 2 and b = −1 into y = mx + b. The equation is y = 2x − 1. Check it with the second point: when x = 6, y = 2 × 6 − 1 = 11, which matches (6, 11). Always check both points. If one point fits and the other does not, the slope or the intercept is wrong.

    Point-Slope Form and Standard Form

    The same line can be written in two other common forms. Point-slope form is y − y1 = m(x − x1), and it needs only the slope and one point, with no need to find b first. For our line, that is y − 3 = 2(x − 2). Expand it and you get y = 2x − 1 again.

    Standard form is Ax + By = C, with whole numbers and A usually positive. Start from y = 2x − 1, move the x term to the left side, and multiply by −1: 2x − y = 1. All three forms describe exactly the same line.

    Positive, Negative, Zero and Undefined Slopes

    The sign of the slope tells you the direction of the line. There are four cases, and each one looks different on a graph.

    Positive Slope

    A positive slope means the line climbs as it moves right. The points (1, 2) and (4, 8) give m = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2, and the equation is y = 2x. For every step right, the line rises 2 units.

    Negative Slope

    A negative slope means the line falls as it moves right. The points (1, 5) and (4, 2) give m = (2 − 5) ÷ (4 − 1) = −3 ÷ 3 = −1. The y-intercept is b = 5 − (−1 × 1) = 6, so the equation is y = −x + 6.

    Zero Slope

    A zero slope means the line is flat. The points (2, 3) and (6, 3) have the same y value, so the rise is 0 and m = 0 ÷ 4 = 0. The equation is y = 3, a horizontal line through y = 3.

    Undefined Slope

    An undefined slope means the line is vertical. The points (4, 1) and (4, 9) have the same x value, so the run is 0, and the formula asks for division by 0, which is not possible. There is no slope-intercept equation for this line. Instead, the equation is x = 4, because every point on the line has x = 4.

    Four cases, one line each: positive climbs, negative falls, zero is flat, and undefined is vertical.

    Parallel and Perpendicular Slopes

    Parallel lines never meet, so they rise at exactly the same rate: parallel lines have equal slopes. The line y = 2x + 5 is parallel to y = 2x − 1, because both have a slope of 2.

    Perpendicular lines cross at a right angle, and their slopes are negative reciprocals: flip the fraction and change the sign. The slope 2 is 2/1, so a perpendicular line has slope −1/2. Multiply the two slopes and you always get −1: 2 × (−1/2) = −1. Vertical and horizontal lines are the one exception, since a vertical line has no slope to flip.

    Distance and Midpoint Between Two Points

    The same two points also tell you how far apart they are. The distance comes from the distance formula, which is the Pythagorean theorem in disguise: d = √((x2 − x1)² + (y2 − y1)²). The run and the rise are the two short sides of a right triangle, and the distance is the long side.

    The classic example is the points (0, 0) and (3, 4). The run is 3 − 0 = 3, and the rise is 4 − 0 = 4. The distance is √(3² + 4²) = √(9 + 16) = √25 = 5. That is the famous 3-4-5 triangle, and it is a handy check. For our main example, (2, 3) and (6, 11), the distance is √(4² + 8²) = √80, about 8.94.

    The midpoint is the point exactly halfway between the two. Average the x values and average the y values: ((x1 + x2) ÷ 2, (y1 + y2) ÷ 2). For (2, 3) and (6, 11), the midpoint is ((2 + 6) ÷ 2, (3 + 11) ÷ 2) = (4, 7). Check: (4, 7) fits y = 2x − 1, because 2 × 4 − 1 = 7.

    Slope, Angle and Percent Grade

    Slope can also be written as an angle or a percent. The angle of incline θ is the angle the line makes with the horizontal, and it comes from the inverse tangent: θ = arctan(m). A slope of 1 is a 45° angle, and a slope of 2 is about 63.43°. Going the other way, m = tan(θ).

    Percent grade is simply the slope times 100, so a slope of 0.06 is a 6% grade. The percentage calculator turns any slope into a percent grade in one step. A common confusion is to think a 100% grade is vertical. It is not: a 100% grade is a slope of 1, a 45° angle, where the rise equals the run.

    SlopePercent gradeAngleExample
    0.066%3.43°Steep highway
    1/12 ≈ 0.0838.33%4.76°Wheelchair ramp
    0.550%26.57°6-in-12 roof pitch
    1100%45°Rise equals run
    2200%63.43°Very steep line

    Ramps, Roofs and Roads: Slope Outside Class

    Slope is not just a classroom idea. It shows up wherever something rises or falls over a distance, and it is usually written as a ratio or a percent.

    Wheelchair ramps are built with a gentle slope so they are safe to use. A common rule is a slope of 1 in 12: the ramp rises 1 unit for every 12 units of length, a slope of about 0.08. A steeper ramp would be hard to push a chair up.

    Roofs are described by their pitch, which is the same idea as slope. A roof that rises 6 feet over a 12-foot run has a slope of 6 ÷ 12 = 0.5. A steeper roof sheds rain and snow faster, while a flatter roof is easier to walk on.

    Roads show steep hills as a percent grade, which is the slope times 100. A 6% grade means the road rises 6 feet for every 100 feet of travel, a slope of 0.06. Truck drivers watch these signs because a long downhill grade needs careful braking.

    How to Use the Slope Calculator

    1. Enter the first point. Type its x value in the x1 box and its y value in the y1 box, for example 2 and 3.
    2. Enter the second point. Type its values in the x2 and y2 boxes, for example 6 and 11.
    3. Read the results. You get the slope, the y-intercept, the equation in y = mx + b form, and the distance between the two points.
    4. Follow the steps. The working shows the rise, the run, and how b was found, so you can compare it with your own work.

    The order of the points does not matter. Swapping them flips the sign of both the rise and the run, so the slope stays the same.

    Five Slope Slips to Watch For

    Most slope mistakes are small slips, not gaps in understanding. The table below lists the ones that appear most often, and how to avoid each one.

    MistakeWhat goes wrongHow to avoid it
    Subtracting in a different order on top and bottomm = (y2 − y1) ÷ (x1 − x2)Always subtract in the same point order in both places.
    Dividing run by risem = (x2 − x1) ÷ (y2 − y1)Slope is rise over run: y values on top, x values on the bottom.
    Calling a vertical line slope 0Saying m = 0 for the line x = 4A vertical line has no slope at all: it is undefined, not 0.
    Reading b from a point that is not on the y-axisTaking b = 3 from the point (2, 3)b is the y value only when x = 0. Use b = y1 − m × x1.
    Thinking a 100% grade is verticalTreating 100% as straight up100% grade is a slope of 1, a 45° angle.

    Five Lines to Work Out Yourself

    Solve all five without the calculator, then compare your answers with the ones below. Each one runs the same four steps: rise, run, divide, then find b.

    1. Points (1, 2) and (5, 10). Answer: m = 2, b = 0, y = 2x, distance 8.94.
    2. Points (0, 3) and (4, 11). Answer: m = 2, b = 3, y = 2x + 3, distance 8.94.
    3. Points (2, 7) and (6, 3). Answer: m = −1, b = 9, y = −x + 9, distance 5.66.
    4. Points (3, 1) and (3, 8). Answer: slope undefined, x = 3, distance 7.
    5. Points (−2, 4) and (2, 4). Answer: m = 0, b = 4, y = 4, distance 4.

    Frequently Asked Questions

    What is the slope formula?

    The slope formula is m = (y2 − y1) ÷ (x2 − x1). It divides the change in y, called the rise, by the change in x, called the run. For the points (2, 3) and (6, 11), that is (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2.

    How do I find the y-intercept from two points?

    First find the slope m, then put the slope and one point into y = mx + b and solve for b, or use b = y1 − m × x1. For the points (2, 3) and (6, 11), the slope is 2, so b = 3 − 2 × 2 = −1.

    What does it mean when the slope is undefined?

    An undefined slope means the line is vertical, so the two points share the same x value and the run is 0. Division by 0 is not possible, so there is no slope. The equation is written as x = a constant, for example x = 4.

    What is the difference between slope 0 and undefined slope?

    A slope of 0 means the line is flat and horizontal, with the same y value everywhere, for example y = 3. An undefined slope means the line is vertical, with the same x value everywhere, for example x = 4. They are opposites, not the same thing.

    How do I find the distance between two points?

    Use the distance formula: d = √((x2 − x1)² + (y2 − y1)²). For the points (0, 0) and (3, 4), that is √(9 + 16) = √25 = 5.

    Can the slope be a decimal or a fraction?

    Yes. The slope is often a decimal or a fraction, for example 4/3 (about 1.33) or 1/2. A slope of 0.5 means the line rises half a unit for every unit it moves right. The calculator above rounds slopes to two decimal places.

    How do I convert slope to an angle?

    Take the inverse tangent of the slope: θ = arctan(m). A slope of 1 gives 45°, a slope of 0.5 gives about 26.57°, and a slope of 2 gives about 63.43°. To go from an angle back to a slope, use m = tan(θ).

    What is the slope of a perpendicular line?

    It is the negative reciprocal of the original slope: flip the fraction and change the sign. A line with slope 2 has perpendicular lines with slope −1/2, and a line with slope −3/4 has perpendicular lines with slope 4/3. Parallel lines, by contrast, have equal slopes.