How to Calculate Slope: Formula, Examples, and Common Traps

💡 "slope calculator" cluster: 100–200K searches/mo⏱️ 7 min read

Slope answers one question: how fast does a line climb? It's the single most useful number attached to a line, it takes one subtraction-and-division to compute, and half the errors on slope homework come from mixing up the order of the points. Here's the formula, worked examples in both directions, and the traps worth knowing about before the test.

Advertisement

What is slope, exactly?

Slope is the rate of change between any two points on a line: how much y moves when x moves 1 unit. A slope of 2 says "go right 1, go up 2." A slope of −3 says "go right 1, go down 3." That's the whole idea, and the graph is just the visual version of it.

The sign carries meaning. Positive slope rises left-to-right, negative slope falls, slope 0 is perfectly flat. The bigger the absolute value, the steeper the line. A slope of 100 is a cliff; a slope of 0.01 is nearly level ground.

How do you find slope from two points?

The formula is rise over run:

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

Two steps, one warning. Step 1: subtract the y-coordinates to get the rise. Step 2: subtract the x-coordinates, in the same order, to get the run. Divide. The warning: if you do (y₂ − y₁) on top, you must do (x₂ − x₁) on the bottom. Flip one and not the other and the sign of your answer is wrong.

Worked example with (2, 3) and (6, 11):

The order of the points doesn't matter — using (6, 11) as "point 1" gives (3 − 11)/(2 − 6) = −8/−4 = 2. Same answer, because both numerator and denominator flip together. Put your own points into the slope calculator and it will run all of this live, including the graph.

Slope, y-intercept, and the full equation

Enter two points and get slope, b, slope-intercept form, point-slope form, angle, distance, and midpoint at once.

Slope Calculator →

How do you get from slope to slope-intercept form?

Slope-intercept form is y = mx + b, and b, the y-intercept, is where the line crosses the y-axis. Once you have m from two points, b is one substitution away: b = y₁ − m·x₁, using either point.

With m = 2 and the point (2, 3): b = 3 − 2(2) = −1. The line is y = 2x − 1. Check it against the other point: 2(6) − 1 = 11. ✓ If the check fails, the most likely culprit is arithmetic in the b step, not the slope.

There's also point-slope form, y − y₁ = m(x − x₁), which skips solving for b. For our example: y − 3 = 2(x − 2). Same line, different packaging. Teachers often want the work shown in point-slope first, then simplified to slope-intercept.

What about vertical and horizontal lines?

Horizontal lines have slope 0: the y-values are equal, the numerator is 0, and 0 divided by anything is 0. Their equation is y = c for some constant.

Vertical lines have undefined slope: the x-values are equal, the denominator is 0, and dividing by zero is not a number. Undefined is not the same as 0, and mixing them up is the classic multiple-choice trap. A vertical line's equation is x = c, and it never fits the y = mx + b template.

How do slope, angle, and percent grade relate?

Same number, three costumes. Angle is arctan(m): slope 1 is 45°, slope 2 is 63.4°, slope 0.5 is 26.6°. Percent grade is m × 100: slope 0.08 is an 8% grade, which on a highway means an advisory sign for trucks. Roofers say "6/12 pitch," which just means m = 6/12 = 0.5 — six inches of rise per foot of run.

Percent grade shows up wherever roads, ramps, and drainage live. The ADA caps most wheelchair ramps at 1:12, a slope of 0.083, which is 8.3% grade or 4.8°. If you're checking a ramp for compliance, the roof pitch calculator does the rise-over-run to angle conversion for inches-per-foot the same way.

How do parallel and perpendicular slopes work?

Parallel lines never meet, so they climb at identical rates: same m, different b. y = 2x − 1 and y = 2x + 5 run side by side forever.

Perpendicular lines cross at 90°, and their slopes are negative reciprocals: flip and negate. m becomes −1/m. Slope 2 pairs with −1/2; slope −3 pairs with 1/3; slope 1/4 pairs with −4. Multiplying the pair always gives −1, which is a fast check. The one exception: horizontal (m = 0) and vertical (undefined) are perpendicular to each other, and the flip-and-negate rule can't express that because −1/0 doesn't exist.

What mistakes should you watch for?

Want to check answers as you practice? Run the same two points through the slope calculator and compare your by-hand work line by line, or graph a few results to build the intuition for what m = 2 versus m = −1/2 actually looks like. For rate problems across a data set instead of a line, the average calculator is the neighboring tool worth knowing.

Advertisement

Frequently Asked Questions

What is the slope formula?

m = (y₂ − y₁) / (x₂ − x₁), read as rise over run. Subtract the two y-coordinates, subtract the two x-coordinates in the same order, and divide. For (2, 3) and (6, 11): (11 − 3) / (6 − 2) = 2.

What does a slope of 2 mean?

The line rises 2 units for every 1 unit it moves right. A slope of −3 falls 3 units per 1 right, a slope of 1/2 rises half a unit per 1 right, and slope 0 runs flat. Steeper lines have slopes further from zero in either direction.

Why is the slope of a vertical line undefined?

Because both points share the same x-coordinate, so the denominator of the rise-over-run fraction is 0, and division by zero has no result. A vertical line is written x = a instead of y = mx + b. Its perpendicular partner, the horizontal line, has slope 0.

How do you write slope-intercept form from two points?

Find m with the slope formula, then solve b = y₁ − m·x₁ using either point. For (2, 3) and (6, 11): m = 2, then b = 3 − 2(2) = −1, giving y = 2x − 1. Check by plugging in the other point: 2(6) − 1 = 11. It works.

Related Tools