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
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)
| Symbol | Meaning | How to interpret |
|---|---|---|
| m | Slope | Rise / Run (change in y divided by change in x) |
| b | Y-intercept | The y-value when x = 0 |
| (x1, y1), (x2, y2) | Two points | Any 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
- 1Compute slope: m = (y₂ − y₁) / (x₂ − x₁).
- 2Solve for intercept using one point: b = y₁ − m·x₁.
- 3Write the equation: y = mx + b.
- 4If x₂ = x₁, the line is vertical (special case): x = x₁ (not y = mx + b).
Worked Examples
| Points | Slope (m) | Intercept (b) | Final equation |
|---|---|---|---|
| (0, 2) and (4, 10) | 2 | 2 | y = 2x + 2 |
| (1, 5) and (3, 5) | 0 | 5 | y = 5 (horizontal line) |
| (2, 1) and (2, 7) | undefined | N/A | x = 2 (vertical line) |
| (-2, 3) and (2, -1) | -1 | 1 | y = -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)
Slope Intercept Calculator FAQs
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).
How do I find slope from two points?
Use m = (y2 − y1) / (x2 − x1).
What if x1 equals x2?
Then the line is vertical and slope is undefined. The equation is x = x1, not y = mx + b.
What does slope = 0 mean?
A slope of 0 means the line is horizontal: y stays constant no matter what x is.
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).
How do I find the y-intercept (b) once I have slope?
Use b = y1 − m·x1 (or b = y2 − m·x2).
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.
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.
