Slope & Line Equation Calculator
Find the slope and equation of a line from two points.
Point 1
Point 2
Quick Examples
Slope Formula
Types of Slope
- Positive slope: Line rises left to right
- Negative slope: Line falls left to right
- Zero slope: Horizontal line (m = 0)
- Undefined slope: Vertical line
Equation Forms
- Slope-intercept: y = mx + b
- Point-slope: y − y₁ = m(x − x₁)
- Standard: Ax + By = C
What Is Slope?
Slope measures how steep a line is — the rate at which y changes for every one-unit change in x. A slope of 2 means the line climbs 2 units vertically for each unit it moves horizontally; a slope of −0.5 means it falls half a unit for each unit it moves right. Slope shows up everywhere in real life: road grades are slopes (a 6% grade rises 6 meters over 100 meters of road), roof pitch is a slope, and in business the slope of a cost line is the price per unit. Mathematically, slope is the ratio of “rise over run,” and it stays constant along any straight line — which is why just two points are enough to pin it down completely.
Finding the Y-Intercept
Once you know the slope m and one point (x₁, y₁), the y-intercept b — where the line crosses the y-axis — comes from rearranging y = mx + b:
For example, a line with slope 2 passing through (3, 10) has b = 10 − 2(3) = 4, so its equation is y = 2x + 4. The intercept is the value of y when x = 0, which in applied problems is often the fixed cost, the starting height, or the baseline measurement before anything changes.
Step-by-Step Calculation
Step 1: Label your two points as (x₁, y₁) and (x₂, y₂). The order does not matter as long as you stay consistent.
Step 2: Subtract the y-values to get the rise: y₂ − y₁.
Step 3: Subtract the x-values to get the run: x₂ − x₁.
Step 4: Divide rise by run: m = (y₂ − y₁) / (x₂ − x₁). If the run is zero, the line is vertical and the slope is undefined — stop here and write x = x₁.
Step 5: Find b with b = y₁ − m·x₁.
Step 6: Write the equation y = mx + b, then verify it by plugging in the second point — both sides must agree.
Worked Examples
Example 1: Positive slope
Points (2, 3) and (5, 11): m = (11 − 3) / (5 − 2) = 8/3 ≈ 2.667. Then b = 3 − (8/3)(2) = 3 − 16/3 = −7/3 ≈ −2.333, giving y = (8/3)x − 7/3. Check with (5, 11): (8/3)(5) − 7/3 = 40/3 − 7/3 = 33/3 = 11. Correct.
Example 2: Negative slope
Points (−1, 4) and (3, −6): m = (−6 − 4) / (3 − (−1)) = −10/4 = −5/2 = −2.5. Then b = 4 − (−5/2)(−1) = 4 − 5/2 = 3/2 = 1.5, giving y = −(5/2)x + 3/2. Check with (3, −6): −(5/2)(3) + 3/2 = −15/2 + 3/2 = −12/2 = −6. Correct.
Example 3: Zero and undefined slope
Points (1, 5) and (7, 5): m = (5 − 5) / (7 − 1) = 0, a horizontal line with equation y = 5. Points (4, 2) and (4, 9): m = (9 − 2) / (4 − 4) = 7/0, which is undefined — a vertical line with equation x = 4.
Common Mistakes
- Subtracting in the wrong order: (y₁ − y₂) / (x₂ − x₁) flips the sign. Keep the same point first in both the numerator and the denominator.
- Missing a zero run: a zero denominator means a vertical line, not a zero slope. Zero slope belongs to horizontal lines only.
- Confusing slope with intercept: m is the steepness, b is where the line crosses the y-axis. They answer different questions.
- Leaving fractions unsimplified: 8/4 should be reported as 2, and equations are far easier to read in lowest terms.
Frequently Asked Questions
Can slope be a fraction? Yes — most slopes are. 8/3 is exact, while 2.667 is an approximation. Keep the fraction when you need exact answers.
What does a slope of 1 mean? The line climbs at 45 degrees, rising exactly one unit for every unit it runs.
How is slope used in real life? Road grades, roof pitch, business rates such as cost per unit, and velocity in physics (distance divided by time) are all slopes.
What is the slope of a horizontal line? Zero — there is no rise at all. A vertical line’s slope is undefined because computing it would mean dividing by zero.
Slope as an Angle
The slope also tells you the line's angle of inclination: θ = arctan(m).
| Slope m | Angle | Meaning |
|---|---|---|
| 0 | 0° | Flat |
| 0.5 | 26.57° | Gentle climb |
| 1 | 45° | Rises as fast as it runs |
| 2 | 63.43° | Steep |
| 10 | 84.29° | Nearly vertical |
| −1 | −45° | Falls as fast as it runs |
Slope as a Percent (Grade)
Road signs quote slope as a percentage: grade = m × 100%. A 6% grade rises 6 meters for every 100 meters of road. A wheelchair ramp built to the common 1:12 standard has slope 1/12 ≈ 0.0833, or about 8.33%.
Parallel and Perpendicular Lines
- Parallel lines have the same slope. If one line has m = 2, every line parallel to it has m = 2.
- Perpendicular lines have slopes that are negative reciprocals: m⊥ = −1/m. A line with slope 2 is perpendicular to a line with slope −1/2, because 2 × (−1/2) = −1.
- The perpendicular of a horizontal line (m = 0) is a vertical line (undefined slope), and vice versa.
Rise Over Run in the Real World
- Roof pitch: a 4/12 pitch rises 4 inches per 12 inches of run — a slope of 1/3, or 33.33%.
- Stairs: comfortable stairs rise about 7 inches per 11-inch tread (slope ≈ 0.64).
- Business: the slope of a cost line is the price per unit; the slope of a revenue line is the price charged per unit.
- Physics: the slope of a distance-time graph is velocity; the slope of a velocity-time graph is acceleration.
Quick Checks
- Plug the second point back in: both sides of y = mx + b must agree — if they do not, the slope or intercept is wrong.
- Match the sign to the direction: a line that rises left to right must have positive m; if yours is negative, recheck the subtraction order.
- Carry the units: slope has units of y per x — dollars per item, meters per second, degrees per hour. Nonsense units usually mean a setup error.