Slope Intercept Calculator: Find Equation of a Line

Find the slope and equation of a line from two points.

Slope Calculator

Find slope and equation of line through two points

Point 1 (x₁, y₁)
Point 2 (x₂, y₂)
Enter coordinates for both points. For slope, x₁ ≠ x₂.

Quick Tips

  • • Positive slope: line rises left to right
  • • Negative slope: line falls left to right
  • • Zero slope: horizontal line
  • • Undefined slope: vertical line

What is Slope-Intercept Form?

Slope-intercept form is one of the easiest ways to write a straight line equation: y = mx + b. Here m is the slope (steepness) and b is the y-intercept (where the line crosses the y-axis).

Key Terms (Quick Meaning)

SymbolMeaningHow to interpret
mSlopeRise / Run (change in y divided by change in x)
bY-interceptThe y-value when x = 0
(x1, y1), (x2, y2)Two pointsAny two distinct points define a unique line (except vertical special case)

Slope Formula from Two Points

Given two points (x₁, y₁) and (x₂, y₂), the slope is:

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

How to Find the Line Equation from Two Points

  1. 1
    Compute slope: m = (y₂ − y₁) / (x₂ − x₁).
  2. 2
    Solve for intercept using one point: b = y₁ − m·x₁.
  3. 3
    Write the equation: y = mx + b.
  4. 4
    If x₂ = x₁, the line is vertical (special case): x = x₁ (not y = mx + b).

Worked Examples

PointsSlope (m)Intercept (b)Final equation
(0, 2) and (4, 10)22y = 2x + 2
(1, 5) and (3, 5)05y = 5 (horizontal line)
(2, 1) and (2, 7)undefinedN/Ax = 2 (vertical line)
(-2, 3) and (2, -1)-11y = -x + 1

Common mistake: If x₂ = x₁, the denominator becomes 0. That means slope is undefined and the correct equation is x = constant, not y = mx + b.

How to Read the Slope (m)

  • Positive slope (m > 0): line goes up as x increases.
  • Negative slope (m < 0): line goes down as x increases.
  • Zero slope (m = 0): horizontal line (y is constant).
  • Undefined slope: vertical line (x is constant).
  • Bigger |m| means the line is steeper.

Why This Form is Useful

Slope-intercept form makes it easy to graph a line quickly: start at the y-intercept (0, b), then use the slope as rise/run. It’s also common in school math, algebra exams, and real-world rate problems.

Visual: y = mx + b (Slope and Intercept)

Start at (0, b), then move up/down (rise) and right (run) based on slope m.

Slope Intercept Calculator FAQs

Q

What is the slope-intercept form of a line?

It’s y = mx + b, where m is the slope (rise/run) and b is the y-intercept (y when x = 0).

Q

How do I find slope from two points?

Use m = (y2 − y1) / (x2 − x1).

Q

What if x1 equals x2?

Then the line is vertical and slope is undefined. The equation is x = x1, not y = mx + b.

Q

What does slope = 0 mean?

A slope of 0 means the line is horizontal: y stays constant no matter what x is.

Q

Can two different points ever give more than one line?

No. Two distinct points define exactly one straight line (except you must handle vertical lines separately).

Q

How do I find the y-intercept (b) once I have slope?

Use b = y1 − m·x1 (or b = y2 − m·x2).

Q

How do I know if two lines are parallel or perpendicular?

Parallel lines have the same slope. Perpendicular lines have slopes that multiply to -1 (m1·m2 = -1), when both slopes are defined.

Q

Why does the line equation fail for vertical lines in y = mx + b?

Because vertical lines have undefined slope, and you can’t represent them as a function y(x). They’re written as x = constant.