Skip to calculator

Learn

The slope formula.

Where m = (y₂ − y₁)/(x₂ − x₁) comes from, how to apply it without slipping on the signs, and the three mistakes behind most wrong answers.

The slope of a line is the change in y divided by the change in x between any two points on it. Written out, that is the slope formula — and every other way of describing steepness, from percent grade to roof pitch, is this same ratio wearing different clothes.

m = (y₂ − y₁) ÷ (x₂ − x₁)

Where It Comes From

Slope answers one question: if I move one unit to the right along this line, how far up or down do I go? To measure that, take any two points on the line and compare them. The vertical difference between them is the rise. The horizontal difference is the run. Dividing one by the other scales the answer down to "per one unit across", which is the slope.

Because the line is straight, it does not matter which two points you pick — the ratio comes out the same every time. That is the defining property of a straight line, and it is what makes a single number enough to describe the whole thing.

A Worked Example

Take the points (2, 3) and (7, 13).

  1. Label them. x₁ = 2, y₁ = 3, x₂ = 7, y₂ = 13.
  2. Rise. y₂ − y₁ = 13 − 3 = 10.
  3. Run. x₂ − x₁ = 7 − 2 = 5.
  4. Divide. m = 10 ÷ 5 = 2.

A slope of 2 means the line climbs two units for every one unit right. To check it, step from (2, 3): right one to x = 3, up two to y = 5. The point (3, 5) should be on the line — and substituting it back into the formula against either original point gives 2 again.

The Order of the Points Does Not Matter

Swapping which point you call "first" flips the sign of both the rise and the run, and the two negatives cancel:

(13 − 3) ÷ (7 − 2) = 10 ÷ 5 = 2
(3 − 13) ÷ (2 − 7) = −10 ÷ −5 = 2

So there is no wrong choice — only an inconsistent one, which brings us to the mistakes.

Three Mistakes That Cause Most Wrong Answers

1. Mixing the order between top and bottom

This is by far the most common. Subtracting the first y from the second, then the second x from the first, gives (y₂ − y₁) ÷ (x₁ − x₂) — which is the negative of the right answer. The sign flips, so the line appears to fall when it rises. Pick an order and use it in both places.

2. Putting the run on top

Slope is rise over run, not run over rise. Inverting it gives the reciprocal, so a slope of 2 becomes 0.5. A quick sanity check: a steep line should give a number bigger than 1, and a gentle one a number smaller than 1. If a nearly flat line is giving you a large answer, the fraction is upside down.

3. Losing a sign with negative coordinates

Subtracting a negative adds. For (−2, 5) and (3, −1): the rise is −1 − 5 = −6 and the run is 3 − (−2) = 5, giving −6/5. Writing the negative coordinate in brackets before subtracting makes this much harder to get wrong.

Reading the Answer

  • Positive — the line rises from left to right.
  • Negative — it falls from left to right.
  • Zero — it is horizontal. The rise is zero, so the whole fraction is zero.
  • Undefined — it is vertical. The run is zero, and dividing by zero produces nothing at all. See types of slope for why "undefined" and "infinite" are not the same claim.

The Same Formula Outside the Classroom

Every practical measure of steepness is this ratio, rescaled. Multiply the slope by 100 and you have a percent grade. Take its inverse tangent and you have the angle in degrees. Express it as rise per 12 units of run and you have a roof pitch. One idea, four notations.

To see the formula applied to your own numbers, with each step written out, use the slope calculator.

Common Questions

What is the slope formula?

The slope formula is m = (y₂ − y₁) / (x₂ − x₁). It gives the slope of the straight line through two points by dividing the change in y — the rise — by the change in x — the run.

Why is slope called rise over run?

Because the numerator measures how far the line rises vertically and the denominator measures how far it runs horizontally between the same two points. The phrase is a plain-language restatement of the formula, and it is easier to remember than the subscripts.

What happens if the denominator is zero?

The two points share the same x-value, so the line is vertical. Division by zero has no result, which is why a vertical line is said to have an undefined slope rather than an infinite one.

Can slope be a fraction?

Yes, and it usually should be left as one. A slope of 2/3 is exact, whereas 0.667 is rounded. Keeping the fraction also makes the line easier to draw: move 3 across and 2 up.