To find the slope of a line through two points, subtract the y-values and divide by the difference of the x-values: slope m = (y₂ − y₁) / (x₂ − x₁). Order matters in both subtractions, but it must match — start with the same point on top and bottom. If the two x-values are identical, the line is vertical and the slope is undefined, not zero.

That formula is the whole method, and everything else in this guide is about using it without tripping over sign errors, mismatched point order, or the vertical-line exception that catches nearly everyone the first time.

Name the Points and Label Them x₁, y₁ and x₂, y₂ Before Any Arithmetic

The most common reason people get the wrong slope isn't the formula — it's sloppy labeling. Write the two points side by side, then assign the first point's coordinates to x₁ and y₁ and the second point's to x₂ and y₂. Keep that assignment visible for the entire calculation.

Consider points A(3, 4) and B(7, 12). You label A as (x₁, y₁) = (3, 4) and B as (x₂, y₂) = (7, 12). Everything downstream depends on this being consistent. If you later swap B's label mid-problem, you'll get a slope with the wrong sign and never notice.

Labeling matters more than it looks because slope is a ratio of two signed differences. The numerator (y₂ − y₁) and denominator (x₂ − x₁) must describe the same direction of travel. Going from A to B, both differences use B minus A. Going from B to A, both use A minus B. The two versions give the same final slope because both signs flip together.

A practical habit: circle the point you're treating as "first" and draw a small arrow toward the "second" point. That arrow is your direction of travel, and both subtractions must follow it. Students who skip this step are the ones who end up with −4 instead of 4 and can't find the error.

Apply the Slope Formula Step by Step: Rise Over Run With Real Numbers

Here's the full sequence on a concrete pair, with each step producing a visible number. Use this order every time and the calculation stays clean.

1: Write the formula: m = (y₂ − y₁) / (x₂ − x₁). 2: Substitute the labeled values. For A(3, 4) and B(7, 12): m = (12 − 4) / (7 − 3). 3: Subtract the numerator (the rise): 12 − 4 = 8. 4: Subtract the denominator (the run): 7 − 3 = 4. 5: Divide: m = 8 / 4 = 2.

The slope is 2, meaning the line rises 2 units for every 1 unit it moves right. That's a positive slope with a moderately steep angle — steeper than a 45-degree line, which has slope 1.

Run the same points in reverse and check: m = (4 − 12) / (3 − 7) = (−8) / (−4) = 2. Same answer. That's the built-in check that catches sign mistakes, and it takes about ten seconds.

If your subtraction yields a fraction like 6/8, reduce it to 3/4 before reporting. Most textbooks and online homework systems accept either form, but reduced fractions are standard. A slope of 0.75 and a slope of 3/4 describe the same line; pick one and stay consistent within a problem set.

Read the Sign and Size of the Slope as a Direction, Not Just a Number

The sign tells you which way the line tilts: positive slopes rise left to right, negative slopes fall, zero is horizontal, and undefined is vertical. The magnitude tells you steepness. A slope of 5 is far steeper than a slope of 1/5, and that difference is visible on any graph without plotting points.

A negative slope example makes this concrete. Take (2, 9) and (6, 1). The rise is 1 − 9 = −8, the run is 6 − 2 = 4, and m = −8/4 = −2. The line drops 2 units for every 1 unit right. Compare that to m = −1/2, which drops just half a unit per step — a gentle decline. Both are negative; only the size distinguishes them.

Zero slope deserves its own warning. It appears when y₁ = y₂, so the numerator is 0 and the fraction equals 0. That's a horizontal line like y = 5, which is flat and completely valid. Students sometimes call this "no slope," which is wrong — zero slope is a real, well-defined number.

Undefined slope appears when x₁ = x₂, so the denominator is 0. Division by zero isn't allowed, so the slope doesn't exist as a number. That's a vertical line like x = 3. The distinction between zero and undefined is the single most tested slope concept, and it trips up people who only memorize the formula.

Handle the Vertical-Line Exception and the Zero-Slope Case Without Guessing

Run the formula on (4, 2) and (4, 11). The numerator is 11 − 2 = 9, the denominator is 4 − 4 = 0, and you're facing 9/0. Stop there. That expression has no value, so the slope is undefined and the line is vertical. Writing "m = 9/0" and then simplifying to 9 is a serious error — you can't cancel a zero.

Run it on (1, 6) and (8, 6) instead. The numerator is 6 − 6 = 0, the denominator is 8 − 1 = 7, and m = 0/7 = 0. That's valid. Zero divided by any nonzero number is zero, so a horizontal line has slope exactly 0.

The rule to memorize: zero in the numerator → slope is 0 (horizontal); zero in the denominator → slope is undefined (vertical). The wording matters on exams and in most algebra platforms, which mark "undefined" and "no slope" differently depending on the system.

Here's a quick reference for the four cases, using the difference values d_y = y₂ − y₁ and d_x = x₂ − x₁:

Vertical difference (d_y) Horizontal difference (d_x) Slope result Line type
8 4 2 Rising, steep
−8 4 −2 Falling, steep
0 7 0 Horizontal
9 0 Undefined Vertical

If you're checking homework on a platform like Khan Academy or a textbook's online companion, confirm how that specific system words the vertical case — some accept "undefined," others want "no slope," and a few ask you to select "does not exist." The math is identical; only the accepted label varies.

Cross-Check With the Point-Slope Form and a Third Point When One Is Available

Once you have m, plug it back into point-slope form, y − y₁ = m(x − x₁), to confirm the line actually passes through both original points. With m = 2 through (3, 4), the equation is y − 4 = 2(x − 3), which simplifies to y = 2x − 2. Test point B(7, 12): 2(7) − 2 = 12. It checks out.

This verification step catches a large share of arithmetic slips because it forces you to rebuild the line and test the second point independently. If the second point fails, either your slope or your substitution was wrong, and you know to redo the subtraction.

If a third point is given, use it as a collinearity test. Three points are collinear only if the slope between the first two equals the slope between the second and third. Take (1, 2), (3, 6), and (5, 10): the first slope is (6 − 2)/(3 − 1) = 2, and the second is (10 − 6)/(5 − 3) = 2. Equal slopes confirm all three sit on one line.

That test is also how you find a missing coordinate. If a line through (2, 5) and (6, k) has slope 3, then (k − 5)/(6 − 2) = 3, so k − 5 = 12 and k = 17. This "find the missing value" variant shows up constantly in algebra coursework, and it's just the slope formula rearranged.

Keep Point Order Consistent to Avoid the Classic Sign Flip

The formula tolerates either order, but it does not tolerate mixing them. Computing (y₂ − y₁) over (x₁ − x₂) flips the sign of the whole slope. That single mistake accounts for a huge share of wrong answers on slope problems, and it produces a slope that looks perfectly reasonable — which is why it survives to the final answer.

Watch it happen with (1, 3) and (5, 11). Correct version: (11 − 3)/(5 − 1) = 8/4 = 2. Mixed version: (11 − 3)/(1 − 5) = 8/(−4) = −2. The line rises, but the mixed version claims it falls. Nothing in the arithmetic feels wrong; the error is purely structural.

The fix is a rule you apply mechanically: after labeling, write the subtraction template once with the labels still in place — (y₂ − y₁)/(x₂ − x₁) — and only then substitute numbers. Doing it in that order makes the mixing error nearly impossible.

If you suspect you've flipped something, run the reverse check described earlier: compute the slope starting from the other point and see whether both versions agree. Agreement means your order is internally consistent; disagreement means you mixed directions somewhere.

Turn the Slope Into a Line Equation and a Graph You Can Draw

Slope on its own is a rate, but it becomes useful when combined with a point to define a line. Using slope-intercept form y = mx + b, substitute m and one point's coordinates, then solve for b, the y-intercept. With m = 2 through (3, 4): 4 = 2(3) + b, so b = −2, giving y = 2x − 2.

Graphing from that equation takes three moves. Plot the y-intercept at (0, −2). From there, apply the slope as rise over run: up 2, right 1, landing at (1, 0). Repeat once more to reach (2, 2), then draw the line through the plotted points. It should pass through both original points, which is your visual confirmation.

A negative slope graphs the same way with a downward step. For m = −2 through the same y-intercept, go down 2 and right 1 from each plotted point. The line falls left to right, matching the negative sign.

For a fraction like m = 3/4, the rise is 3 and the run is 4 — the denominator always gives the horizontal step. Treating a fractional slope as "up 3, over 4" keeps the graph accurate without converting to a decimal, which is helpful when the decimal repeats.

Use Slope as a Rate in Real Contexts, With Units Attached

Slope is a rate of change, so real problems usually attach units. If a hiker gains 1,200 feet of elevation over 3 miles of horizontal trail, the slope is 1,200/3 = 400 feet per mile. That's a rise-over-run in physical terms, and the units tell you what the number means.

A cost example works identically. If a service charges $180 for 4 hours and $300 for 8 hours, the slope is (300 − 180)/(8 − 4) = 120/4 = 30 dollars per hour. That $30 is the marginal rate — what each additional hour costs — which is exactly what slope measures in a linear pricing model.

Watch the units carefully, though. Mixing feet and miles gives a slope in feet per mile, which is correct only if you say so. Converting first (3 miles = 15,840 feet) yields a unitless slope of about 0.076, which represents the same grade expressed as a ratio. Both are right; they answer slightly different questions.

Slope also shows up as a grade in construction and road design, where a "6% grade" means a slope of 0.06 — a rise of 6 units per 100 units of run. Converting between percent grade and slope is just multiplying or dividing by 100, and it's a useful sanity check when a problem's answer seems too steep.

Avoid the Four Errors That Produce Wrong Slopes Most Often

Most incorrect slope answers trace back to a small set of repeatable mistakes, and each one has a specific fix. Knowing them in advance is faster than diagnosing them after the fact.

Subtracting x from y. The formula is (y₂ − y₁) over (x₂ − x₁), not the reverse. Keep the labels visible until substitution is done. Mixing point order. Both differences must run in the same direction. Use the reverse-check to confirm consistency. Simplifying n/0 into a number. A zero denominator means undefined slope — full stop. There's no valid simplification. Dropping negative signs during subtraction. For (2, −3) and (5, 4), the numerator is 4 − (−3) = 7, not 1. Subtracting a negative adds.

That last error is the sneakiest because the arithmetic looks fine if you rush it. Working with negative coordinates, write the double negative explicitly — 4 − (−3) — before simplifying to 7.

A useful habit for all four: after computing, ask whether the sign and steepness make sense for the two points. If the second point is clearly higher and to the right, the slope must be positive, and a negative result signals an error somewhere in the subtraction.

FAQ

What's the difference between slope 0 and undefined slope?

Slope 0 means a horizontal line, produced when y₁ = y₂ and the numerator is zero; undefined slope means a vertical line, produced when x₁ = x₂ and the denominator is zero. Only the second case is "undefined" — the first is a perfectly valid number. Many grading systems mark them differently, so check the accepted wording.

Does it matter which point I call (x₁, y₁)?

No — either assignment gives the same slope, as long as you use the same point first in both the numerator and denominator. Swapping both labels reverses the direction of travel but flips both signs, and the two negatives cancel. The slope value is unchanged; only the intermediate numbers differ.

How do I find the slope if one point is missing a coordinate?

Set up the slope formula with the unknown in place and solve algebraically. For a line through (2, 5) and (6, k) with slope 3: (k − 5)/(6 − 2) = 3, so k − 5 = 12 and k = 17. This "find the missing value" setup is common in standardized test questions.

Can a slope be a decimal instead of a fraction?

Yes. A slope of 3/4 equals 0.75, and both are correct. Fractions are usually preferred in algebra because they preserve exact values and make graphing easier — the denominator is the horizontal run. Convert to decimals only when the problem specifies decimal answers.

What slope does a line through (5, 2) and (5, 9) have?

It's undefined, because x₁ = x₂ = 5 makes the denominator 9 − 2 = 0 after the subtraction order is set correctly. The numerator is 7, giving 7/0, which has no value. The line is vertical, and "undefined" is the standard label rather than "0" or "infinity."

Is slope the same thing as the distance between two points?

No. Slope measures steepness as a ratio of vertical change to horizontal change, while distance measures the straight-line length between the two points. For (1, 2) and (4, 6), the slope is 4/3, but the distance is 5 by the Pythagorean theorem — two different quantities from the same pair.

Why do I get a negative slope when the line clearly rises?

You almost certainly mixed point order, computing (y₂ − y₁) over (x₁ − x₂) or the reverse. Redo the subtraction with both differences running in the same direction and the sign corrects itself. A quick sanity check: if the second point is higher and to the right, the slope must be positive.