How to Find the Slope of a Line (From Two Points or an Equation)

Slope is rise over run. Find it from two points, a graph or an equation, and convert it to a percent grade or angle for ramps, roofs and roads.

The slope of a line measures its steepness as rise over run: the change in y divided by the change in x between any two points. The formula is m = (y₂ − y₁) ÷ (x₂ − x₁). For the points (2, 3) and (6, 11), the slope is (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2, meaning the line climbs 2 units for every 1 unit to the right.

The slope formula

m = (y2 − y1) ÷ (x2 − x1) = rise ÷ run

The letter m is the traditional symbol for slope. It does not matter which point you call “1” and which “2,” as long as you subtract in the same order on top and bottom.

Step by step

  1. Label the points (x₁, y₁) and (x₂, y₂).
  2. Subtract the y-values to get the rise.
  3. Subtract the x-values in the same order to get the run.
  4. Divide rise by run and simplify.

Points (−1, 4) and (3, −2)

Rise = −2 − 4 = −6   ·   Run = 3 − (−1) = 4

m = −6 ÷ 4 = −3/2 = −1.5

Subtracting negative numbers is where most errors happen: 3 − (−1) is 4, not 2. The slope calculator shows each subtraction, along with the line’s equation and angle.

The four kinds of slope

Slope Direction Example
Positive Rises left to right m = 2
Negative Falls left to right m = −1.5
Zero Horizontal y = 4, m = 0
Undefined Vertical x = 4, run = 0

The larger the absolute value, the steeper the line: a slope of −5 is steeper than a slope of 2.

Slope from an equation

Slope-intercept form, y = mx + b. The slope is the coefficient of x, and b is where the line crosses the y-axis. In y = −0.75x + 3, the slope is −0.75.

Standard form, Ax + By = C. The slope is −A ÷ B.

Ax + By = C   ⇒   m = −A ÷ B

For 3x + 4y = 12, m = −3/4. Solving for y gives the same thing: 4y = −3x + 12, so y = −0.75x + 3.

From a graph. Pick two points where the line crosses grid intersections, count the squares up or down (rise) and across (run), and divide.

Writing the equation of a line

Once you have the slope and one point, the point-slope form gives the equation:

y − y1 = m(x − x1)

With m = 2 through (2, 3): y − 3 = 2(x − 2), which simplifies to y = 2x − 1. Check with the other point: 2(6) − 1 = 11 ✓.

Parallel and perpendicular lines

  • Parallel lines have equal slopes. Any line parallel to y = 2x − 1 has slope 2.
  • Perpendicular lines have slopes that are negative reciprocals, so their product is −1. A line perpendicular to one with slope 2 has slope −1/2.

Two lines with different slopes always intersect exactly once, which is the basis of solving linear systems; see how to solve a system of equations.

Slope as percent grade and angle

Outside the classroom, slope is usually written as a percentage or an angle.

grade = m × 100%   ·   angle = arctan(m)
Ratio (rise:run) Slope m Percent grade Angle
1:50 0.02 2% 1.15°
1:12 0.0833 8.33% 4.76°
6:100 0.06 6% 3.43°
1:4 0.25 25% 14.04°
4:12 0.333 33.3% 18.43°
6:12 0.5 50% 26.57°
1:1 1 100% 45°
2:1 2 200% 63.43°

A 100% grade is 45°, not vertical; a vertical wall has an infinite grade. The angle comes from the inverse tangent, available on the inverse trig functions calculator.

Accessibility ramps

The 2010 ADA Standards for Accessible Design limit the running slope of a ramp to 1:12, one inch of rise per 12 inches of run. A porch 30 inches above grade therefore needs at least 30 × 12 = 360 inches, or 30 feet, of ramp, and the standards also limit each run’s rise to 30 inches before a landing. Accessible routes that are not ramps must be no steeper than 1:20.

Roof pitch

Roofers describe slope as inches of rise per 12 inches of run. A 6/12 pitch is a slope of 0.5 and an angle of about 26.6°. The roof pitch calculator converts between pitch, angle and percent.

Roads and drainage

Highway grades are typically kept to a few percent, and a “6% grade” sign means 6 feet of drop per 100 feet of travel. Patios and walks are usually sloped about 1 to 2 percent (roughly ⅛ to ¼ inch per foot) away from a house so water drains off.

Slope as a rate of change

Slope is not just geometry; it is the rate at which one quantity changes with another, measured in “y-units per x-unit.”

At 7 a.m. it is 52°F; at 1 p.m. it is 70°F

Slope = (70 − 52) ÷ (13 − 7) = 18 ÷ 6 = 3°F per hour

Speed is the slope of a distance-time graph, and a car’s fuel economy is the slope of distance against fuel used. In calculus, the derivative extends the idea to curves by taking the slope at a single point.

Common mistakes

  • Run over rise. Slope is vertical change divided by horizontal change. Flipping it gives the reciprocal, which for a 1:12 ramp would claim a slope of 12.
  • Mismatched order. Computing y₂ − y₁ on top but x₁ − x₂ on the bottom flips the sign.
  • Calling a vertical line’s slope zero. Zero belongs to horizontal lines; vertical lines are undefined.
  • Confusing grade with angle. A 10% grade is about 5.7°, not 10°.
  • Mixing units. A rise in inches over a run in feet must be converted before the ratio means anything.

The same two points give you more than slope. Their straight-line distance comes from the Pythagorean theorem, using the rise and run as legs, and their midpoint is the average of the coordinates. The distance calculator and midpoint calculator find both, and how to use the Pythagorean theorem explains the distance formula.

Frequently asked questions

What is the formula for slope?

m = (y₂ − y₁) ÷ (x₂ − x₁), the change in y divided by the change in x between two points on the line. For (2, 3) and (6, 11), the slope is (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2.

What does a negative slope mean?

The line falls as you move from left to right: y decreases as x increases. A slope of −1.5 means the line drops 1.5 units for every 1 unit to the right.

What is the difference between zero slope and undefined slope?

A horizontal line has zero slope because its rise is 0. A vertical line has an undefined slope because its run is 0, and you cannot divide by zero. Horizontal lines have equations like y = 4; vertical lines like x = 4.

How do I convert slope to an angle?

Take the inverse tangent: angle = arctan(slope). A slope of 1 is 45°, a slope of 0.5 is about 26.57°, and a 1:12 ramp slope of 0.0833 is about 4.76°.

How do I find slope from an equation in standard form?

For Ax + By = C, the slope is −A ÷ B. For 3x + 4y = 12, the slope is −3/4. You can also solve for y to get slope-intercept form: y = −0.75x + 3.