Slope of a Line: Interactive Rise Over Run Explorer

Drag points A and B on a grid and watch the dashed rise-over-run triangle, the slope formula, and the line's equation update live, including the zero and undefined slope cases.

Drag the two points (or use arrow keys) and watch the rise, the run, and the slope formula update live.

Interactive slope explorerA coordinate grid with two draggable points; the line through them, its rise-over-run triangle, and the slope formula update as you drag.-5-5-4-4-3-3-2-2-1-11122334455run 4rise 4A (-2, -1)B (2, 3)
m = (3 - -1) / (2 - -2) = 4 / 4 = 1
Positive slope

Uphill left to right: y rises as x grows.

Line through A and B: y = x + 1

Point A at (-2, -1), point B at (2, 3). slope m = (3 - -1) / (2 - -2) = 4 / 4 = 1. Uphill left to right: y rises as x grows.

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:

  1. Label the points. Call one (x₁, y₁) and the other (x₂, y₂). Either choice works, as long as you stay consistent.
  2. Subtract to get rise and run. rise = y₂ - y₁ and run = x₂ - x₁, keeping the points in the same order in both subtractions.
  3. Divide. m = rise / run, then simplify the fraction.

Worked example. Find the slope of the line through (1, 2) and (5, 10).

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.

SlopeThe lineRise and runExplorer badge
Positive (m > 0)uphill left to rightrise and run have the same signPositive slope
Negative (m < 0)downhill left to rightrise and run have opposite signsNegative slope
Zero (m = 0)horizontalrise = 0, so m = 0 / run = 0Zero slope
Undefinedverticalrun = 0, and dividing by zero has no valueUndefined 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.

Common slope mistakes

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.

Frequently asked questions

What is the slope of a line?
Slope is a number that measures a line's steepness and its direction. It equals rise over run: the vertical change divided by the horizontal change between any two points on the line. A line has the same slope everywhere, so any two points give the same value. Positive slope goes uphill left to right, negative slope goes downhill, zero slope is a horizontal line, and a vertical line's slope is undefined.
What is the slope formula?
The slope formula is m = (y₂ - y₁) / (x₂ - x₁), where (x₁, y₁) and (x₂, y₂) are any two points on the line. The numerator is the rise (vertical change) and the denominator is the run (horizontal change). Keep the points in the same order in both subtractions; mixing the order flips the sign of the answer.
How do you find the slope of a line from two points?
Subtract the y-coordinates to get the rise, subtract the x-coordinates in the same order to get the run, then divide rise by run. For (1, 2) and (5, 10): rise = 10 - 2 = 8, run = 5 - 1 = 4, so the slope is 8 / 4 = 2.
What does rise over run mean?
Rise is how far you move vertically between two points on a line (up is positive, down is negative), and run is how far you move horizontally (right is positive). Slope is rise divided by run, so a slope of 3/4 means the line climbs 3 units for every 4 units you move to the right.
What is the difference between zero slope and undefined slope?
A horizontal line has zero slope: its rise is 0, and 0 divided by any nonzero run is 0, a real number. A vertical line has undefined slope: its run is 0, and division by zero has no value. Zero slope means perfectly flat; undefined means the formula returns no number at all, and the line has no y = mx + b form, only x = a constant.
Is a slope of -2 steeper than a slope of 1?
Yes. Steepness is measured by the absolute value of the slope, and direction by its sign. A line with slope -2 falls 2 units for every 1 unit to the right, which is steeper than a slope of 1 climbing 1 unit per 1 across. The negative sign only says the line goes downhill from left to right.

Sources

Last reviewed: 2026-07-02

Embed this on your site

Free to use. Paste this anywhere; a link back to PrepOK is included.

Related