MathPath
Grades 1–13 Math Hub
Interactive Math Tool & Complete Study Guide

Slope & Line Equation Calculator

Find slope (m), y-intercept (b), equation y = mx + b, distance, and midpoint from two points. Complete with step-by-step calculation breakdown, plain-English how-to guides, worked examples, common mistakes to avoid, practice questions, and printable worksheets.

Jump to Guide: How to Find the Slope Between Two PointsHow to Write Slope-Intercept Form ($y = mx + b$)Worked ExamplesCommon MistakesRelated Worksheets

Key Formulas & Rules

Slope Formula

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

Slope-Intercept Form

$$y = mx + b$$

Distance & Midpoint

$$d = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}, \quad M = \left(\frac{x_1+x_2}{2},\frac{y_1+y_2}{2}\right)$$

4 Types of Slope at a Glance

Slope ValueLine Direction (Left → Right)Equation Pattern
Positive ($m > 0$)Rises uphill$y = 2x + 1$
Negative ($m < 0$)Falls downhill$y = -3x + 5$
Zero ($m = 0$)Horizontal flat line$y = 4$
Undefined ($\Delta x = 0$)Vertical straight-up line$x = 2$

How to Find the Slope Between Two Points

Slope ($m$) measures steepness as Rise over Run—how much $y$ changes for every $1$-unit increase in $x$.

  1. Step 1 — Label both points: Assign $(x_1, y_1)$ and $(x_2, y_2)$.
  2. Step 2 — Subtract in the SAME order: $m = \frac{y_2 - y_1}{x_2 - x_1}$.
  3. Step 3 — Simplify the fraction: For $(2,3)$ and $(6,11)$, $m = \frac{11 - 3}{6 - 2} = \frac{8}{4} = 2$.

How to Write Slope-Intercept Form ($y = mx + b$)

Once you know the slope $m$, plug either point into $y = mx + b$ to solve for the y-intercept $b$.

  1. Step 1 — Substitute $m$ and one point: With $m = 2$ and $(2, 3)$, write $3 = 2(2) + b$.
  2. Step 2 — Solve for $b$: $3 = 4 + b \implies b = -1$.
  3. Step 3 — Write the final equation: $y = 2x - 1$.

Step-by-Step Worked Examples

Worked Example 1

Line through $(2, 3)$ and $(6, 11)$

$m = \frac{11-3}{6-2} = 2$. Plug $(2,3)$ into $y=2x+b$: $b = -1$, so $y = 2x - 1$.

Worked Example 2

Negative slope through $(1, 8)$ and $(5, 0)$

$m = \frac{0-8}{5-1} = -2$. Equation: $y = -2x + 10$.

Worked Example 3

Horizontal line through $(-3, 4)$ and $(7, 4)$

$m = \frac{4-4}{7-(-3)} = 0$, so the equation is simply $y = 4$.

Worked Example 4

Vertical line through $(5, 1)$ and $(5, 9)$

$\Delta x = 5 - 5 = 0$, so slope is undefined and the equation is $x = 5$.

Common Mistakes & How to Avoid Them

Common Mistake #1

Putting x on top instead of y (Run over Rise)

Slope is ALWAYS $\frac{\Delta y}{\Delta x}$ (vertical change over horizontal change), never $\frac{\Delta x}{\Delta y}$.

Common Mistake #2

Switching the subtraction order between numerator and denominator

If you do $y_2 - y_1$ on top, you MUST do $x_2 - x_1$ on the bottom—never $x_1 - x_2$.

Common Mistake #3

Confusing zero slope with undefined slope

Zero divided by a number ($\frac{0}{5}=0$) is a horizontal line; dividing by zero ($\frac{5}{0}$) is undefined (vertical line).

Quick Practice Questions (Check Your Understanding)

Try solving these on scratch paper first, then expand each card to verify your steps.

Practice #1: Practice Problem 1: Line through $(2, 3)$ and $(6, 11)$

Solution: $m = \frac{11-3}{6-2} = 2$. Plug $(2,3)$ into $y=2x+b$: $b = -1$, so $y = 2x - 1$.

Practice #2: Practice Problem 2: Negative slope through $(1, 8)$ and $(5, 0)$

Solution: $m = \frac{0-8}{5-1} = -2$. Equation: $y = -2x + 10$.

Practice #3: Practice Problem 3: Horizontal line through $(-3, 4)$ and $(7, 4)$

Solution: $m = \frac{4-4}{7-(-3)} = 0$, so the equation is simply $y = 4$.

Frequently Asked Questions

Does it matter which point is (x₁, y₁) and which is (x₂, y₂)?
No! As long as you subtract in the same direction for both $y$ and $x$, both negatives cancel out and give the exact same slope.
How do you find perpendicular and parallel slopes?
Parallel lines have the exact same slope ($m_2 = m_1$). Perpendicular lines have negative reciprocal slopes ($m_2 = -\frac{1}{m_1}$).