What is the slope of a line?
The slope of a line is one number that captures two things at once: how steep the line is and which direction it tilts. It tells you how many units the line rises for every unit it runs to the right. A slope of 2 means up 2 for every 1 across; a slope of 1/2 means up 1 for every 2 across; a negative slope means the line goes downhill instead.
The fact that makes slope so useful: a line has the same slope everywhere. Pick any two points on it, close together or far apart, and rise divided by run comes out the same. The explorer above lets you test that directly: drag points A and B anywhere on the coordinate plane (they snap to whole-number grid points, and arrow keys work too) and the slope updates live.
Rise over run
Between any two points, the rise is the vertical change (up is positive, down is negative) and the run is the horizontal change (right is positive, left is negative). Slope is their ratio, rise over run.
The explorer draws this as a dashed right triangle attached to the line: the teal leg along the bottom is the run and the amber leg up the side is the rise, each labeled with its value. The triangle is the picture; the formula below is the same idea in symbols.
The slope formula
m = (y₂ - y₁) / (x₂ - x₁) = rise / run
Here (x₁, y₁) and (x₂, y₂) are any two points on the line, and m is the standard letter for slope, the same m that appears in y = mx + b. Subtracting the y-coordinates gives the rise; subtracting the x-coordinates gives the run.
The readout under the graph substitutes A’s and B’s coordinates straight into this formula. With the starting points A(-2, -1) and B(2, 3) it reads m = (3 - -1) / (2 - -2) = 4 / 4 = 1. Those double negatives are worth a look: subtracting a negative adds, so 3 - -1 = 4.
How to find the slope of a line
Given two points, finding the slope takes three steps:
- Label the points. Call one (x₁, y₁) and the other (x₂, y₂). Either choice works, as long as you stay consistent.
- Subtract to get rise and run. rise = y₂ - y₁ and run = x₂ - x₁, keeping the points in the same order in both subtractions.
- Divide. m = rise / run, then simplify the fraction.
Worked example. Find the slope of the line through (1, 2) and (5, 10).
- rise = 10 - 2 = 8
- run = 5 - 1 = 4
- m = 8 / 4 = 2
The order of the points does not matter, as long as it is consistent. Start from (5, 10) instead and rise = 2 - 10 = -8, run = 1 - 5 = -4, and m = -8 / -4 = 2 again: the two sign flips cancel. What breaks the calculation is mixing the orders, (10 - 2) / (1 - 5) = 8 / -4 = -2, which has the wrong sign.
To see a slope of 2 in the explorer, drag A to (1, 2) and B to (2, 4): the readout shows m = (4 - 2) / (2 - 1) = 2 / 1 = 2, and the triangle’s rise (2) is twice its run (1).
Positive, negative, zero, and undefined slope
Every line falls into exactly one of four cases, and the explorer’s badge names which one you have built.
| Slope | The line | Rise and run | Explorer badge |
|---|---|---|---|
| Positive (m > 0) | uphill left to right | rise and run have the same sign | Positive slope |
| Negative (m < 0) | downhill left to right | rise and run have opposite signs | Negative slope |
| Zero (m = 0) | horizontal | rise = 0, so m = 0 / run = 0 | Zero slope |
| Undefined | vertical | run = 0, and dividing by zero has no value | Undefined slope |
The pair students mix up is the bottom two. Zero slope is a real slope. A horizontal line is perfectly flat: its rise is 0, and 0 divided by any nonzero run is 0, an ordinary number. Its equation is y = some constant, which is y = mx + b with m = 0. A vertical line is different in kind: its run is 0, so the formula asks you to divide by zero, and division by zero has no value. The slope is not 0 and not “infinity”; it is undefined. Because there is no m, a vertical line has no y = mx + b form at all. Its equation is x = a constant.
Worked example (vertical line). Take (3, 1) and (3, 7): rise = 7 - 1 = 6, but run = 3 - 3 = 0, so m = 6 / 0 is undefined. The line through them is simply x = 3.
Slope in the real world
Slope shows up anywhere one quantity changes steadily against another.
- Wheelchair ramps. The ADA guideline caps ramp slope at 1:12: at most 1 inch of rise for every 12 inches of run, a slope of about 0.083. A gentler slope means a longer ramp for the same door height.
- Road grades. A “6% grade” sign means a slope of 0.06: the road rises or falls 6 feet for every 100 feet of horizontal run. Trucks care because a small-looking slope adds up over miles.
- Distance-time graphs. On a graph of distance against time, the slope is the speed: the rise is meters covered, the run is seconds elapsed, so rise over run is meters per second. A steeper line is a faster trip, and a flat line (zero slope) means standing still.
- Stairs. A typical stair step rises about 7 inches over an 11-inch tread: slope 7/11, roughly 0.64. That is why stairs feel dramatically steeper than any ramp.
Common slope mistakes
- Flipping the fraction: run over rise. The formula is rise over run, vertical change on top. Flipping it gives the reciprocal (a slope of 2 becomes 1/2), turning steep lines shallow and shallow lines steep. Anchor it to the picture: the y-differences always go on top.
- Mixing the subtraction order. (y₂ - y₁) / (x₁ - x₂) flips the sign of the answer, so an uphill line comes out negative. Whichever point contributes its y first must contribute its x first. Consistent order, right sign, every time.
- Swapping zero and undefined. Horizontal is zero (a real, flat slope); vertical is undefined (no value at all). If you catch yourself saying “no slope”, stop and ask which of the two you mean; the table above settles it.
The explorer above also works as a slope calculator: drag A and B onto your two points and the formula line computes m for you.
It’s free to embed on your own site or LMS. Next, see what the m does inside a full equation in slope-intercept form, or build a line from a single point and a slope in point-slope form.