Slope Calculator

Find the slope, y-intercept, line equation and distance between any two points — free, no signup, private. Includes the exact formula, worked examples, a slope-types reference and FAQs.

Flat vector illustration of a graph with a rising slope
Slope (m)
0.5 rise / run
Y-intercept (b) & line equation
0 y-intercept
Equation & distance
y = 0.5x
Distance between points
4.4721 units

Slope — the quick answer

The slope of a line is a single number that tells you how steep the line is: the ratio of vertical change (rise) to horizontal change (run) between any two points on the line. A slope of 0.5 means the line rises 1 unit for every 2 units it moves right; a slope of 2 means it rises 2 units for every 1 unit right — twice as steep.

The sign matters just as much as the size. Positive slope climbs uphill from left to right, negative slope falls downhill, zero slope is perfectly flat, and undefined slope is a perfectly vertical line (you can't divide by zero). The calculator above works all of this out instantly — slope, y-intercept, the line equation, and even the distance between your two points.

A short history: from Descartes to "rise over run"

The idea of slope grew out of analytic geometry, born in 1637 when René Descartes published La Géométrie — and, around the same time, Pierre de Fermat independently developed similar ideas. For the first time, a geometric line could be described by an equation in x and y, and the "steepness" of that equation became a quantity you could compute, compare and manipulate.

Teachers eventually needed a simple way to express that steepness, and "rise over run" became the universal mnemonic: how far the line climbs divided by how far it travels. Nobody knows exactly why the letter m became the standard symbol for slope — theories range from the French monter ("to climb") to mathematicians simply running out of letters. The mystery survives in every algebra textbook today.

Three centuries later, that same ratio quietly powers modern life: civil engineers grade roads and ramps with it, roofers pitch roofs with it, and in calculus the slope of a curve — the derivative — became the engine of physics, engineering and economics. Every "rate of change" is slope wearing a different hat.

How it works: the formula

m = (y2 − y1) ÷ (x2 − x1)

Subtract the y-coordinates for the rise, subtract the x-coordinates for the run, and divide. Once you have the slope, the full line follows from the point–slope and slope–intercept forms:

y − y1 = m(x − x1)   →   y = mx + b   where   b = y1 − m·x1

The distance between the points comes from the Pythagorean theorem:

d = √((x2 − x1)² + (y2 − y1)²)
Example 1: Points (0, 0) and (4, 2).
m = (2 − 0) ÷ (4 − 0) = 2 ÷ 4 = 0.5. Intercept: b = 0 − 0.5 × 0 = 0, so the equation is y = 0.5x. Distance: √(16 + 4) = √20 ≈ 4.4721.
Example 2 (vertical line): Points (1, 1) and (1, 5).
Run = 1 − 1 = 0, so division by zero is impossible — the slope is undefined and the equation is simply x = 1. Distance: √((0)² + (4)²) = 4.

Slope types reference table

Every line falls into exactly one of these four families. The example point pairs show what each type looks like in practice:

TypeSlope valueWhat it looks likeExample pointsEquation
Positivem > 0Rises left to right(0, 0) → (4, 2)y = 0.5x
Negativem < 0Falls left to right(0, 3) → (4, 0)y = −0.75x + 3
Zerom = 0Perfectly horizontal(−2, 5) → (4, 5)y = 5
Undefined—Perfectly vertical(1, −2) → (1, 5)x = 1

How steep is it really? Slope in everyday life

Slope hides inside dozens of everyday measurements. Here are six you'll recognize — each expressed as a plain rise-over-run number:

0.3334:12 roof pitch

A typical house roof rises 4 units for every 12 across — slope 1/3.

0.0833wheelchair ramp 1:12

Accessibility standards: 1 unit of rise per 12 of run, so nobody has to climb.

0.40"40% grade" ski run

Steep resort runs are labelled in percent — 40% means slope 0.40.

0.088% road grade sign

That yellow warning on mountain roads: 8% = slope 0.08.

0.636standard stairs

A 7-inch riser over an 11-inch tread — the stair code sweet spot.

0.0524aircraft glide slope

Airliners descend on a 3° path — tan(3°) ≈ 0.0524.

Visual guide: rise, run and slope on a graph

The line through (0, 0) and (4, 2), drawn on a coordinate plane. The dashed triangle shows the rise and run directly — slope is simply rise ÷ run = 2 ÷ 4 = 0.5:

Rise ÷ run: slope on a coordinate plane x y 1 2 3 4 5 1 2 3 rise = 2 run = 4 (0, 0) (4, 2) m = rise ÷ run = 2 ÷ 4 = 0.5

Figure: the line through (0, 0) and (4, 2). The pink dashed leg is the rise (2), the purple dashed leg is the run (4), and slope = rise ÷ run = 0.5.

Common mistakes to avoid

Slope arithmetic is simple — but these four slips trip up almost everyone at least once:

  • Subtracting in mismatched order. Compute (y2 − y1) ÷ (x2 − x1) with the same point first in both. Mixing the order, like (y2 − y1) ÷ (x1 − x2), flips the sign of your answer.
  • Confusing zero slope with undefined slope. A horizontal line has slope 0 (it exists, it's just flat); a vertical line has undefined slope (no number works, since run = 0). They are opposites, not synonyms.
  • Forgetting that vertical lines have no y-intercept. A vertical line never crosses the y-axis (unless it is the y-axis), so "b" doesn't exist for it — its whole identity is the equation x = c.
  • Putting rise and run upside down. Slope is rise ÷ run, not run ÷ rise. The flipped version gives the reciprocal — a perfectly good number that answers the wrong question.

Pro tips & mental math

Small tricks that make slope problems faster and harder to get wrong:

  • The intercept shortcut. You only need one point for b: plug it into b = y − m·x. Check with the other point afterward to catch arithmetic slips.
  • Percent grade in one step. Multiply any slope by 100 to get the road-sign percentage: a slope of 0.08 is an 8% grade.
  • Slope ↔ angle. Slope is the tangent of the line's angle above horizontal: m = tan(θ). A 45° hill has slope exactly 1, and steeper than 45° means slope greater than 1.
  • Parallel and perpendicular lines. Parallel lines share the same slope; perpendicular slopes multiply to −1 (so a line perpendicular to slope 2 has slope −1/2).

Printable cheat sheet

Print a clean one-page slope reference — the four slope types with example points and equations — with one click. Navigation and widgets are automatically hidden in the printout:

Fun facts

  • Nobody knows why slope is "m". The leading theory is the French monter ("to climb") — but no document proves it. It's one of mathematics' oldest unsolved naming mysteries.
  • Slope is angle in disguise. m = tan(θ), where θ is the line's angle above horizontal. A 45° line has slope exactly 1 — steeper than 45° means a slope greater than 1.
  • The steepest residential street on Earth — Baldwin Street in Dunedin, New Zealand — climbs at a 35% grade, a slope of 0.35. It looks almost climbable in photos; in person it's a wall.
  • Slope became calculus. The derivative — the idea behind all of physics, engineering and machine learning — is simply "rise over run" applied to curves, letting the run shrink toward zero.

The complete guide

The guide covers rise over run from two points, the four slope types, y = mx + b, and parallel and perpendicular lines.

Read: Slope Calculator — The Complete Guide →

Frequently asked questions

What is the slope of a line?

The slope is a number describing a line's steepness — vertical change (rise) divided by horizontal change (run). For points (x1, y1) and (x2, y2): m = (y2 − y1) ÷ (x2 − x1). A slope of 0.5 means the line rises 1 unit for every 2 units it runs.

What is the difference between zero slope and undefined slope?

Zero slope is a perfectly horizontal line (rise = 0): points (−2, 5) and (4, 5) give m = 0 and equation y = 5. Undefined slope is a perfectly vertical line (run = 0): points (1, −2) and (1, 5) involve division by zero, so no slope exists and the equation is x = 1.

Can slope be a fraction or a decimal?

Yes — slope is any real number. The points (0, 0) and (4, 2) give slope 2/4 = 0.5, and negative values like −2/3 are common. The sign tells you whether the line rises or falls as you move right.

How do you find the slope from a graph?

Pick two easy-to-read points on the line, count the vertical change (rise) and horizontal change (run) between them, then divide rise by run. Up 2 grid units while moving right 4 means slope 2 ÷ 4 = 0.5.

What is the slope of a vertical line?

A vertical line has undefined slope, because the run is zero and you cannot divide by zero. Its equation is written as x = c, where c is the x-coordinate shared by every point on the line.

How is slope used in real life?

Everywhere: roof pitch, road grades (6% = slope 0.06), wheelchair ramp ratios (1:12), ski-run difficulty, stair design, and even economics. Anywhere one quantity changes with another, slope measures the rate.