How to Calculate the Slope of a Line: Rise Over Run
Published 2/16/2026 · 4 min read · Everyday calculators
The slope of a line measures how steeply it rises or falls, and it equals rise over run: m = (y₂ − y₁) / (x₂ − x₁). Pick any two points on the line, subtract the y-values for the rise, subtract the x-values for the run, and divide. For the points (1, 2) and (4, 8), the slope is (8 − 2) / (4 − 1) = 6 / 3 = 2, meaning the line climbs 2 units up for every 1 unit right. A positive slope rises, a negative slope falls, a zero slope is flat, and a vertical line has an undefined slope.
Find the slope of a line from two points with m = (y₂ − y₁) / (x₂ − x₁), and read what a positive, negative, zero, or undefined slope tells you.
Rise over run, step by step
Slope answers a simple question: as you move along the line to the right, how much does it go up or down? The rise is the vertical change and the run is the horizontal change, and their ratio is the slope. Because a straight line has a constant steepness, you can pick any two points on it and always get the same number.
The one rule to respect is order: subtract the coordinates in the same direction on top and bottom. For (1, 2) and (4, 8), doing (8 − 2) / (4 − 1) = 2 is correct, and so is (2 − 8) / (1 − 4) = −6 / −3 = 2. What breaks it is mixing the order — (8 − 2) / (1 − 4) = 6 / −3 = −2 — which flips the sign and gives the wrong answer.
What the sign of the slope means
A positive slope means the line goes up as you read left to right, like a hill you climb. A negative slope means it goes down. The bigger the number's magnitude, the steeper the line: a slope of 5 is much steeper than a slope of 0.5, and a slope of −3 falls sharply. The sign tells direction and the size tells steepness.
Two special cases stand out. A horizontal line has zero slope: it never rises, so the rise is 0 and 0 divided by any run is 0. A vertical line has an undefined slope: the run is 0, and dividing by zero is not allowed, so the slope simply does not exist. These two extremes bracket every other line you will meet.
Slope in the line equation and real life
Slope is the m in the slope-intercept equation y = mx + b, where b is the y-intercept, the point where the line crosses the vertical axis. Once you know the slope from two points, plug either point into y = mx + b to solve for b and you have the full equation of the line. From there you can predict the y-value at any x.
The idea shows up everywhere outside the classroom. A road's grade is its slope written as a percentage, so a 6% grade rises 6 meters for every 100 traveled. A wheelchair ramp with a 1-in-12 slope rises 1 unit for every 12 of length. On a graph of distance over time, the slope is the speed. Slope turns a picture of a line into a rate you can use.
Worked with our own calculator
Slope calculator
Given
- x₁
- 1
- y₁
- 1
- x₂
- 2
- y₂
- 5
Result
- Slope (m)
- 4
- y-intercept (b)
- -3
These figures are produced by the calculator below, not typed in by hand — they are recomputed whenever the tool changes.
Run it on your own figures →Frequently asked questions
- Does it matter which point I call point 1?
- No, as long as you are consistent. Whichever point you label first, use its coordinates first in both the top and the bottom of the fraction. If you subtract y-values in one order but x-values in the other, you flip the sign and get the wrong slope.
- What is the slope of a horizontal line?
- Zero. A horizontal line never rises or falls, so y₂ − y₁ = 0, and zero divided by any nonzero run is zero. Its equation is simply y = b, a constant. This is different from a vertical line, whose slope is undefined.
- How do I turn a slope into a percentage grade?
- Multiply the slope by 100. A slope of 0.06 is a 6% grade, meaning 6 units of rise per 100 of horizontal distance. This is how road signs and ramps express steepness, and it is just the rise-over-run ratio scaled up.
- How are slopes of parallel and perpendicular lines related?
- Parallel lines have equal slopes, since they rise at the same rate. Perpendicular lines have slopes that are negative reciprocals: multiply them and you get −1. So a line with slope 2 is perpendicular to one with slope −1/2.
Articles you may find interesting
All guides →Related tools
Sources
Spotted a mistake in this article?