Slope of a Line - Formula, Calculation, Examples

#Geometry
TL;DR
The slope of a line - sometimes called the gradient — measures the line's steepness as the ratio of vertical change to horizontal change between any two points: $m = \frac{y_2 - y_1}{x_2 - x_1}$, or "rise over run."
BT
Bhanzu TeamLast updated on May 15, 20269 min read

What Is the Slope of a Line?

The slope of a line is a number that describes its steepness and direction. Geometrically, it's the ratio of rise (vertical change) to run (horizontal change) between any two points on the line.

The formula, given two points $(x_1, y_1)$ and $(x_2, y_2)$:

$$m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{\text{rise}}{\text{run}} = \frac{\Delta y}{\Delta x}$$

The Greek letter $\Delta$ (delta) is shorthand for "change in." The slope is the change in $y$ per unit change in $x$ — what mathematicians and physicists call the rate of change.

What Is the Slope Formula?

Given any two points $(x_1, y_1)$ and $(x_2, y_2)$ on a line:

$$m = \frac{y_2 - y_1}{x_2 - x_1}$$

Worked example. Find the slope of the line through $(2, 3)$ and $(6, 7)$.

$$m = \frac{7 - 3}{6 - 2} = \frac{4}{4} = 1$$

The slope is $1$ — the line rises 1 unit for every 1 unit right.

Worked example. Find the slope through $(2, 3)$ and $(5, 11)$.

$$m = \frac{11 - 3}{5 - 2} = \frac{8}{3}$$

The slope is $\tfrac{8}{3}$ — the line rises 8 units for every 3 units right (a steep climb).

What Are the Four Types of Slope?

The sign and form of the slope tell you the line's direction at a glance.

Type

Slope Value

What the Line Does

Positive

$m > 0$

Rises from left to right

Negative

$m < 0$

Falls from left to right

Zero

$m = 0$

Horizontal line ($y$ = constant)

Undefined

$\Delta x = 0$

Vertical line ($x$ = constant)

Positive Slope

Line goes up as you move right. Example: $m = 2$, $m = \tfrac{1}{3}$.

Negative Slope

Line goes down as you move right. Example: $m = -3$, $m = -\tfrac{2}{5}$.

Zero Slope (Horizontal Line)

Horizontal line. $y = 5$ has slope 0 because there's no vertical change as $x$ varies.

Undefined Slope (Vertical Line)

Vertical line. $x = 3$ has undefined slope because the denominator $x_2 - x_1 = 0$, and division by zero is undefined.

How Do You Find Slope From a Graph?

Pick any two clearly-marked points on the line. Count vertical units between them (the rise) and horizontal units (the run). Slope is rise divided by run.

Tip. Choose points with integer coordinates whenever possible — they make the arithmetic cleaner.

Tip. The slope is the same between any two points on the line. Pick the easiest two.

What Is the Slope of Parallel Lines?

Two non-vertical lines are parallel if and only if they have equal slopes.

$$m_1 = m_2$$

The reason is geometric: parallel lines have the same direction — they never meet — so the rise-per-run ratio is identical for both.

Worked example. The line $y = 3x + 4$ is parallel to $y = 3x - 7$. Both have slope $3$. They tilt up at the same rate; only the $y$-intercept (where they cross the vertical axis) differs.

Worked example. Is the line through $(1, 2)$ and $(4, 11)$ parallel to $y = 3x + 1$?

Slope through the two points: $m = \frac{11 - 2}{4 - 1} = \frac{9}{3} = 3$.

Slope of $y = 3x + 1$: $m = 3$.

Equal slopes ✓ — the lines are parallel.

Edge case. Two vertical lines (each with undefined slope) are parallel to each other — but the rule "equal slopes" can't be checked because the slope value doesn't exist. Treat parallel vertical lines as a separate case.

What Is the Slope of Perpendicular Lines?

Two non-vertical lines are perpendicular if and only if the product of their slopes is $-1$ — that is, their slopes are negative reciprocals of each other.

$$m_1 \cdot m_2 = -1 \quad \text{equivalently} \quad m_2 = -\frac{1}{m_1}$$

Geometrically, rotating a line 90° flips its rise-and-run and inverts the ratio with a sign change — that's where the negative reciprocal comes from.

Worked example. A line has slope $2$. The slope of any line perpendicular to it is $-\tfrac{1}{2}$. Check: $2 \times -\tfrac{1}{2} = -1$ ✓.

Worked example. A line has slope $-\tfrac{3}{4}$. The slope of any line perpendicular to it is $\tfrac{4}{3}$ (flip the fraction, flip the sign). Check: $-\tfrac{3}{4} \times \tfrac{4}{3} = -1$ ✓.

Worked example. Is the line $y = \tfrac{1}{2}x + 3$ perpendicular to $y = -2x + 5$?

$m_1 = \tfrac{1}{2}$, $m_2 = -2$. Product: $\tfrac{1}{2} \times (-2) = -1$ ✓ — yes, perpendicular.

Edge case. A horizontal line ($m = 0$) and a vertical line (slope undefined) are perpendicular to each other — but the $m_1 \cdot m_2 = -1$ rule breaks because one slope is undefined. Treat the horizontal/vertical pair as a separate case.

Memory aid. Parallel = same; perpendicular = flip and negate.

Why Does Slope Matter? (The Real-World GROUND)

"Cogito ergo sum… and every line has a slope." — adapted, but Descartes invented coordinate geometry in 1637.

The slope concept appears everywhere a rate is measured. Some examples:

  • Road grade. A road labeled "7% grade" has a slope of $0.07$ — it rises 7 metres per 100 metres horizontal. Highway design rules limit grades to keep trucks safe.

  • Wheelchair ramp standards. The Americans with Disabilities Act (ADA) specifies a maximum ramp slope of 1:12 (about $m \approx 0.083$). Steeper ramps are unsafe.

  • Speed and velocity. On a position-vs-time graph, the slope is the velocity. A horizontal line means stationary; a steep upward line means fast motion.

  • Linear regression. In statistics, the slope of the best-fit line tells you how much $y$ changes per unit increase in $x$ — the regression coefficient.

  • Stair steps. Building codes specify stair slope limits — typically a rise of 7 inches over a run of 11 inches gives a slope of about $7/11 \approx 0.64$.

  • Skiing and roof pitch. A "double black diamond" ski run typically has a slope of $\tan(35°) \approx 0.7$ or steeper. A 4:12 roof pitch has slope $1/3$.

Slope is the unit-conversion between change in one quantity and change in another — the fundamental operation in any quantitative relationship.

The concept comes from René Descartes and Pierre de Fermat, who independently invented analytic geometry in the 1630s. Their breakthrough — equations and shapes are two sides of the same coin — made slope a number you could compute, not just a property you could see.

A Worked Example

Find the slope of the line through $(-2, 5)$ and $(4, -7)$.

The intuitive (wrong) approach. A student in a hurry mixes up the subtraction order — putting $y_2 - y_1$ on top but $x_1 - x_2$ on the bottom:

$$m \stackrel{?}{=} \frac{-7 - 5}{-2 - 4} = \frac{-12}{-6} = 2$$

The answer is wrong (the correct slope is $-2$, not $2$).

Why it fails. The slope formula requires same order on top and bottom — if you do $y_2 - y_1$ on top, you must do $x_2 - x_1$ on bottom. Flipping just one direction produces the negative of the actual slope.

The correct method.

$$m = \frac{y_2 - y_1}{x_2 - x_1} = \frac{-7 - 5}{4 - (-2)} = \frac{-12}{6} = -2$$

The slope is $-2$ — the line falls 2 units for every 1 unit right.

Check. Plot the two points. From $(-2, 5)$ to $(4, -7)$ goes 6 right and 12 down — slope $\frac{-12}{6} = -2$ ✓.

At Bhanzu, our trainers teach this wrong-path-first sequence intentionally — the rusher who keeps top and bottom in inconsistent order is the most common archetype to hit this slip, and the only way the rule sticks is to feel the sign flip once.

What Are the Most Common Mistakes With Slope?

Mistake 1: Flipping numerator and denominator order inconsistently

Where it slips in: Computing slope from two points with the wrong subtraction order.

Don't do this: $m = \frac{y_1 - y_2}{x_2 - x_1}$ — top and bottom in different orders.

The correct way: Pick one order — $\frac{y_2 - y_1}{x_2 - x_1}$ — and stick with it on both. Either direction works; inconsistent directions produce the wrong sign. The rusher who skips writing out subscripts first makes this most often.

Mistake 2: Calling a vertical line "zero slope"

Where it slips in: Confusing vertical (undefined) with horizontal (zero).

Don't do this: Stating the slope of $x = 3$ is 0.

The correct way: $x = 3$ is a vertical line. Its slope is undefined (denominator $\Delta x = 0$). Horizontal lines have slope 0. Memory aid: zero is flat; undefined is vertical. The memorizer who pattern-matches "line is special → slope is 0" hits this constantly.

Mistake 3: Dividing rise/run as a decimal when fraction is exact

Where it slips in: Reporting $m \approx 0.667$ instead of $m = \tfrac{2}{3}$.

Don't do this: Approximating slopes that are clean fractions.

The correct way: When rise and run are integers, keep the slope as a fraction — $\frac{2}{3}$, not $0.667$. Decimal approximation introduces rounding error in subsequent computations. The second-guesser who asks "is this an exact ratio?" is right to ask.

The real-world version of the mistake:

Civil engineers designing the Lombard Street curves in San Francisco famously had to redesign the original straight slope down Russian Hill — the natural slope of 27% was too steep for cars to safely descend without the modern zigzag. Mathematical precision on slope isn't classroom pedantry; in road design, the slope number is the difference between a usable road and a vehicle disaster.

The Mathematicians Who Shaped Slope

René Descartes (1596–1650, France) — Invented analytic geometry in his 1637 book La Géométrie, connecting algebraic equations to geometric curves through the coordinate plane (now called the Cartesian plane). The concept of slope as a number depends entirely on his coordinate system.

Pierre de Fermat (1607–1665, France) — Independently developed analytic geometry around the same time as Descartes. Fermat's work on curves and tangent lines anticipated the differential calculus concept that slope is the instantaneous rate of change.

Isaac Newton (1643–1727, England) — Generalised the slope concept to curves via differential calculus. The derivative is the slope of the tangent line — the rate of change at a single point — and Newton's Principia (1687) used this idea to derive the laws of motion.

A Practical Next Step

Try these three before moving to linear equations.

  1. Find the slope through $(1, 4)$ and $(5, 12)$.

  2. Find the slope through $(-3, 7)$ and $(2, -3)$. (Watch the signs.)

  3. Find the slope of $y = 6$. Then find the slope of $x = -2$.

If problem 2 had a sign issue, return to the wrong-path-first example — consistent subtraction order is the trap. Want a live Bhanzu trainer to walk through more slope problems? Book a free demo class — online globally.

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is the slope of a line in simple words?
The slope is a number that tells you how steep a line is and which way it tilts. It's the rise (how far up) divided by the run (how far right). A slope of 2 means the line rises 2 units for every 1 unit right.
What is the slope formula?
For two points $(x_1, y_1)$ and $(x_2, y_2)$: $m = \frac{y_2 - y_1}{x_2 - x_1}$. The same formula in words: change in $y$ over change in $x$, or "rise over run."
What is rise over run?
It's another name for slope: the vertical change ("rise") between two points divided by the horizontal change ("run") between them. Same idea, same formula. Stair pitch, road grade, and ramp specifications all use rise-over-run.
What is a zero slope?
A horizontal line has a slope of 0 — because $y$ doesn't change as $x$ varies, the rise is 0. Example: $y = 5$ has slope 0.
What is an undefined slope?
A vertical line has an undefined slope — because $x$ doesn't change as $y$ varies, the run is 0, and division by zero is undefined. Example: $x = 3$ has undefined slope. Different from zero slope.
How do you find slope from a graph?
Pick two clearly-marked points on the line. Count vertical units between them (rise) and horizontal units (run). Slope = rise / run. Always check the sign: if the line falls left-to-right, the slope is negative.
What does a positive vs negative slope mean?
Positive slope: the line goes up as you move right (climbing). Negative slope: the line goes down as you move right (descending). Zero slope: flat. Undefined: vertical.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now →