What Is the Slope Formula?
By the Calculator.hair team · Updated · 7 min read
Short answer
The slope formula is m = (y₂ − y₁) ÷ (x₂ − x₁), the change in y divided by the change in x between two points on a line. For the points (2, 3) and (6, 11), m = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2, so the line rises 2 units for every 1 unit it moves right.
Key takeaways
- Slope is rise over run: the vertical change divided by the horizontal change.
- Positive slopes climb from left to right, negative slopes fall, horizontal lines have a slope of 0, and vertical lines have an undefined slope.
- Slope-intercept form is y = mx + b, and point-slope form is y − y₁ = m(x − x₁). They describe the same line.
- Percent grade is slope times 100, so a slope of 0.08 is an 8% grade.
- A 100% grade is a 45° angle, not a vertical wall.
What is the formula for slope?
The formula for slope is m = (y₂ − y₁) ÷ (x₂ − x₁), where (x₁, y₁) and (x₂, y₂) are any two points on the line. The letter m is the standard symbol for slope. The top of the fraction, called the rise, is the vertical change. The bottom, called the run, is the horizontal change.
Slope tells you how steep a line is and which way it tilts. Because a straight line has a constant steepness, any two points on it give the same answer.
How do you find the slope of a line from two points?
Subtract the y-values, subtract the x-values in the same order, and divide. Our slope calculator does this for you and also reports the angle, percent grade, intercepts and equation.
The order of the points does not matter as long as you keep it consistent. Starting from (6, 11) gives (3 − 11) ÷ (2 − 6) = −8 ÷ −4 = 2, the same result. Mixing the order, such as (11 − 3) ÷ (2 − 6), flips the sign and gives the wrong answer of −2.
Here are the steps for the points (2, 3) and (6, 11):
- Label the points: x₁ = 2, y₁ = 3, x₂ = 6, y₂ = 11.
- Find the rise: 11 − 3 = 8.
- Find the run: 6 − 2 = 4.
- Divide: m = 8 ÷ 4 = 2.
What do positive, negative, zero and undefined slope mean?
The sign of the slope tells you the direction of the line, read from left to right. A positive slope rises, a negative slope falls, a zero slope is flat, and an undefined slope is vertical.
A vertical line has an undefined slope because its run is 0, and division by zero has no value. An undefined slope is different from a slope of 0, which comes from a rise of 0 and is a valid number. The table shows one example of each type as our calculator reports it.
| Type | Points | Calculation | Slope | Equation |
|---|---|---|---|---|
| Positive | (2, 3) and (6, 11) | 8 ÷ 4 | 2 | y = 2x − 1 |
| Negative | (1, 7) and (5, 1) | −6 ÷ 4 | −1.5 (−3/2) | y = −1.5x + 8.5 |
| Zero | (1, 4) and (6, 4) | 0 ÷ 5 | 0 | y = 4 |
| Undefined | (3, 1) and (3, 6) | 5 ÷ 0 | Undefined | x = 3 |
What is the equation of a line in slope-intercept form?
Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept, the y-value where the line crosses the vertical axis. It is the most common way to write the equation of a line because you can read both values at a glance.
To build the equation from two points, find the slope and then substitute one point to solve for b. With m = 2 and the point (2, 3): 3 = 2 × 2 + b, so b = 3 − 4 = −1. The equation is y = 2x − 1. To check it, put in the other point: 2 × 6 − 1 = 11, which matches. The line crosses the y-axis at −1 and the x-axis at 0.5. To work with the algebra in more depth, see how to solve equations.
What is point-slope form?
Point-slope form is y − y₁ = m(x − x₁), where m is the slope and (x₁, y₁) is any known point on the line. Use it when you know one point and the slope but not the y-intercept.
For a line through (2, 3) with a slope of 2, the point-slope equation is y − 3 = 2(x − 2). Expand it to reach slope-intercept form: y − 3 = 2x − 4, so y = 2x − 1. This is the same line as before. Using the point (6, 11) instead gives y − 11 = 2(x − 6), which also simplifies to y = 2x − 1.
The calculator's second form takes one point and a slope and also returns the equation. It can also find a point at a set distance along the line. Starting at (2, 3) with a slope of 2 and a distance of 5, it gives (4.23606798, 7.47213595) in one direction and (−0.23606798, −1.47213595) in the other.
| Form | Equation | Best for | Example |
|---|---|---|---|
| Slope-intercept | y = mx + b | Reading slope and intercept | y = 2x − 1 |
| Point-slope | y − y₁ = m(x − x₁) | Starting from a point and a slope | y − 3 = 2(x − 2) |
| Standard | Ax + By = C | Finding intercepts, solving systems | 2x − y = 1 |
| Horizontal line | y = c | Slope of 0 | y = 4 |
| Vertical line | x = c | Undefined slope | x = 3 |
How do you find the slope from an equation or a graph?
If the equation is in the form y = mx + b, the slope is the number multiplied by x. In y = −1.5x + 8.5, the slope is −1.5. For standard form, Ax + By = C, rearrange to get m = −A ÷ B. In 2x − y = 1, A = 2 and B = −1, so m = −2 ÷ −1 = 2.
On a graph, pick two points where the line crosses grid intersections. Count the squares up or down, then count the squares to the right, and divide. Up is positive and down is negative when you move to the right.
Slope also tells you how lines relate. Parallel lines have equal slopes. Perpendicular lines have slopes that are negative reciprocals of each other, so a line perpendicular to y = 2x − 1 has a slope of −1/2.
How do you convert slope to a percent grade?
Multiply the slope by 100 to get the percent grade. A road that rises 8 feet over 100 feet of horizontal distance has a slope of 0.08 and an 8% grade. To convert slope to an angle, use the inverse tangent: θ = arctan(m). That same 8% grade is about 4.57°.
The 2010 ADA Standards limit the running slope of an accessible ramp to 1:12, meaning 1 unit of rise per 12 units of run. That works out to 8.33% or about 4.76°, with narrow exceptions for existing buildings. Roof pitch uses the same idea: a 4-in-12 roof has a slope of 1/3. See how to calculate roof squares for how pitch affects roof area.
The results in the table come from our calculator. Grades above 100% are real: a slope steeper than 45° simply has more rise than run.
| Rise : run | Slope | Percent grade | Angle |
|---|---|---|---|
| 1 : 100 | 0.01 | 1% | 0.57° |
| 1 : 20 | 0.05 | 5% | 2.86° |
| 2 : 25 | 0.08 | 8% | 4.57° |
| 1 : 12 | 0.0833 | 8.33% | 4.76° |
| 1 : 10 | 0.1 | 10% | 5.71° |
| 1 : 3 | 0.3333 | 33.33% | 18.43° |
| 1 : 2 | 0.5 | 50% | 26.57° |
| 1 : 1 | 1 | 100% | 45° |
| 2 : 1 | 2 | 200% | 63.43° |
What mistakes should you avoid with the slope formula?
Most slope errors come from a swapped fraction or a dropped minus sign.
- Dividing run by rise. For (2, 3) and (6, 11), that gives 0.5 rather than 2.
- Subtracting in a different order on the top and the bottom.
- Losing a sign with negative coordinates. Subtracting −2 is the same as adding 2.
- Calling a vertical line's slope 0. It is undefined, while a horizontal line's slope is 0.
- Assuming 100% grade means vertical. It means rise equals run, a 45° angle.
Calculators in this guide
Frequently asked questions
How do you find the slope of a line?
Pick two points and divide the difference in y by the difference in x. For (1, 7) and (5, 1), m = (1 − 7) ÷ (5 − 1) = −1.5.
What is the equation of a line?
It is an equation that all points on the line satisfy, most often written as y = mx + b. A line with a slope of 2 and a y-intercept of −1 is y = 2x − 1.
What is the slope of a horizontal line?
It is 0, because the rise between any two points is 0. Its equation has the form y = c, such as y = 4.
How do you write a point-slope equation?
Put the slope and a known point into y − y₁ = m(x − x₁). A line through (2, 3) with a slope of 2 is y − 3 = 2(x − 2).
What does a slope of 1/12 mean?
The line rises 1 unit for every 12 units of horizontal run. That is an 8.33% grade, or about 4.76°.