1. Home
  2. Guides
  3. How to find slope from two points, a graph or an equation
Everyday math

How to find slope from two points, a graph or an equation

Find slope as rise over run from two points, a graph, a table or an equation, then turn it into a percent grade or angle. Worked examples and common traps.

Calculator Simply cover image for the guide 'How to find slope'

Slope is rise over run

Slope measures how steep a line is: how much y changes for each one-unit change in x. Pick two points on the line, subtract the y values to get the rise, subtract the x values in the same order to get the run, and divide. In symbols, m = (y₂ − y₁) ÷ (x₂ − x₁).

The sign tells you the direction. A positive slope rises as you move to the right, a negative slope falls, a slope of zero is flat, and a vertical line has no defined slope at all because its run is zero.

Any two points on a straight line give the same slope. If you get different answers from different pairs of points, either the points are not on one straight line or a subtraction went wrong.

Worked examplePoints (2, 3) and (8, 15): rise = 15 − 3 = 12, run = 8 − 2 = 6, slope = 12 ÷ 6 = 2. The line climbs 2 units for every 1 unit to the right.

Finding slope from two points, step by step

Label the points before you subtract, so the order stays consistent. Call one point (x₁, y₁) and the other (x₂, y₂). It does not matter which is which, as long as you use the same order on top and bottom.

Negative coordinates are where most errors creep in. Subtracting a negative number means adding it. Write the subtraction out in full, with parentheses, rather than doing it in your head.

Once you have the slope, you can write the line’s equation. Substitute one point into y = mx + b and solve for b. The Slope Calculator does this for you and reports the exact fraction alongside the decimal, which helps when the slope does not divide evenly.

Worked examplePoints (−1, 4) and (3, −2): rise = −2 − 4 = −6, run = 3 − (−1) = 4, slope = −6 ÷ 4 = −3/2 = −1.5. Then 4 = −1.5 × (−1) + b, so b = 2.5 and the line is y = −1.5x + 2.5.

Reading slope from a graph, a table or an equation

On a graph, choose two points where the line crosses grid intersections exactly, so you are not estimating. Count the vertical squares between them (up is positive, down is negative), then the horizontal squares to the right, and divide.

In a table of x and y values, take any two rows and apply the formula. If the x values go up by 1 each row, the slope is simply the amount y changes from one row to the next. Check a second pair of rows to confirm the relationship is actually linear.

From an equation in slope-intercept form, y = mx + b, the slope is the number multiplying x. If the equation is in standard form, such as 3x + 2y = 12, solve for y first. Subtract 3x from both sides and divide by 2 to get y = −1.5x + 6, so the slope is −1.5. For Ax + By = C in general, the slope is −A ÷ B.

Worked exampleTable: x = 0, 1, 2 with y = 5, 8, 11. y rises by 3 each time x rises by 1, so the slope is 3. Equation: 3x + 2y = 12 → 2y = −3x + 12 → y = −1.5x + 6, slope −1.5.

Slope in the real world: grade, ratio and angle

Builders and road engineers describe the same idea in different ways. A ratio like 1:12 means one unit of rise for every twelve units of horizontal run. A percent grade is the slope times 100. An angle is the inverse tangent of the slope.

The 2010 ADA Standards for Accessible Design say ramp runs must have a running slope not steeper than 1:12. The Slope Calculator shows that 1:12 is a slope of 0.083333, or about 8.33% grade and 4.76°. The same standards define a ramp as a walking surface steeper than 1:20, which is a 5% grade.

Say a planned ramp rises 2 feet over 30 feet of horizontal distance. Entering (0, 0) and (30, 2) gives a slope of 1/15, about 0.0667 or 6.67%, which is gentler than 1:12. A full ramp design also has to satisfy rules on landings, width and handrails, so treat the slope check as one piece of the job.

Worked exampleRamp: rise 2 ft, run 30 ft. Slope = 2 ÷ 30 = 0.066667 = 6.67% grade, angle ≈ 3.81°. Limit check: 1 ÷ 12 = 0.083333 = 8.33%, so 6.67% is within it.

The run is horizontal, not along the surface

Slope uses the horizontal distance, but on site it is often easier to measure along the sloping surface itself. These are different lengths. The surface is the hypotenuse of a right triangle whose legs are the run and the rise.

The Pythagorean Theorem Calculator shows the size of the difference. For the 30 ft run and 2 ft rise, the sloped length is 30.066593 ft, only about 0.8 inch longer. On gentle slopes the error from measuring along the surface is small. On steep ones, such as a roof, it grows quickly, so work out the horizontal run from the sloped length when you need precision: run = √(length² − rise²).

Worked example√(30² + 2²) = √904 = 30.066593 ft along the surface. Reverse check: √(30.066593² − 2²) = √(904 − 4) = √900 = 30 ft of horizontal run.

Mistakes to watch for

Flipping the fraction. Run over rise gives the reciprocal. A line with slope 2 would come out as 0.5, which describes a much flatter line.

Subtracting in opposite orders. Using y₂ − y₁ on top and x₁ − x₂ on the bottom flips the sign. A rising line then looks like it falls.

Mixing units. A rise in inches and a run in feet gives a number twelve times too large. Convert both to the same unit first.

Confusing zero and undefined. A horizontal line has a slope of 0. A vertical line, such as the one through (3, 1) and (3, 7), has an undefined slope because the run is 0; the calculator reports it as the line x = 3.

Which calculator to use

Use the Slope Calculator whenever you have two points. It returns the slope as a fraction and a decimal, the y-intercept, the equation of the line, the distance between the points and the angle, which saves several separate calculations.

Use the Pythagorean Theorem Calculator when you need the length along a slope from its rise and run, such as the length of a ramp surface, a rafter or a sloped path. For a quick percent grade, multiply the slope from either tool by 100.

Sources and further reading

Try the calculators