Slope Calculator
This slope calculator finds the slope of the line through two points: the rise divided by the run, m = (y₂ − y₁) ÷ (x₂ − x₁). Through (1, 2) and (4, 8) the slope is 6 ÷ 3 = 2.
Sources: OpenStax Algebra and Trigonometry 2e, Wikipedia Updated
Slope through (1, 2) and (4, 8)
m = 2
- Equation
- y = 2x
- y-intercept
- 0
- Angle with the x-axis
- 63.43°
- Distance between the points
- ≈ 6.708204
- Midpoint
- (2.5, 5)
Show steps Here’s how we got it
Label the two points
(x1, y1) = (1, 2)
(x2, y2) = (4, 8)
It does not matter which point you call the first, as long as you keep the order the same in both subtractions.
Find the rise (change in y)
y2 − y1 = 8 − 2 = 6
Find the run (change in x)
x2 − x1 = 4 − 1 = 3
Divide rise by run
m = rise/run = 6/3 = 2
Positive slope: the line goes up from left to right.
Find the y-intercept
b = y1 − m × x1 = 2 − 2 × 1 = 0
This is where the line crosses the y-axis.
Write the equation of the line
y = 2x
Slope-intercept form is y = mx + b.
The slope formula
The slope m says how much y changes when x goes up by 1. Once you have it, the y-intercept and the equation of the line follow, in the slope-intercept form used by OpenStax Algebra and Trigonometry:
How to find the slope from two points: a worked example
Find the slope and the equation of the line through (−2, 5) and (4, −1).
Label the two points
(x1, y1) = (−2, 5)
(x2, y2) = (4, −1)
It does not matter which point you call the first, as long as you keep the order the same in both subtractions.
Find the rise (change in y)
y2 − y1 = −1 − 5 = −6
Find the run (change in x)
x2 − x1 = 4 − (−2) = 6
Divide rise by run
m = rise/run = −6/6 = −1
Negative slope: the line goes down from left to right.
Find the y-intercept
b = y1 − m × x1 = 5 − (−1) × (−2) = 3
This is where the line crosses the y-axis.
Write the equation of the line
y = −x + 3
Slope-intercept form is y = mx + b.
Answer: m = −1
Positive, negative, zero and undefined slope
| Slope | The line | Example |
|---|---|---|
| Positive | Rises from left to right | y = 2x + 1 |
| Negative | Falls from left to right | y = −x + 3 |
| Zero | Horizontal | y = 3 |
| Undefined | Vertical | x = 2 |
The calculator also gives the distance between the two points and their midpoint.
Slope as a rate of change
When x and y are real quantities, the slope is a rate: kilometres per hour, dollars per item, degrees per day. Between two points on a curve it is the average rate of change.
When the data has more than two points that do not lie on one line, the best single slope comes from the linear regression calculator, which fits the least-squares line.
Slope as a percentage, a ratio and an angle
Road signs and building plans usually give slope as a percent grade: the slope times 100, or the rise for every 100 units of run. A 1:100 slope rises 1 for every 100 across, which is a slope of 0.01 or 1%. The angle with the horizontal is the inverse tangent of the slope, as Wikipedia's article on grade sets out.
| Percent grade | Slope m | Ratio (rise:run) | Angle |
|---|---|---|---|
| 1% | 0.01 | 1:100 | 0.57° |
| 2% | 0.02 | 1:50 | 1.15° |
| 5% | 0.05 | 1:20 | 2.86° |
| 6% | 0.06 | 1:16.67 | 3.43° |
| 8.33% | 0.0833 | 1:12 | 4.76° |
| 10% | 0.1 | 1:10 | 5.71° |
| 25% | 0.25 | 1:4 | 14.04° |
| 50% | 0.5 | 1:2 | 26.57° |
| 100% | 1 | 1:1 | 45° |
A 1% slope falls 1 inch over 100 inches of run, or 0.12 inch per foot. For any other grade, enter (0, 0) and (100, the percent) as the two points: the calculator gives the slope and its angle with the x-axis.
Slope practice question
Find the slope of the line through (3, 7) and (5, 15), and write its equation.
Check your answer
Answer: m = 4
Label the two points
(x1, y1) = (3, 7)
(x2, y2) = (5, 15)
It does not matter which point you call the first, as long as you keep the order the same in both subtractions.
Find the rise (change in y)
y2 − y1 = 15 − 7 = 8
Find the run (change in x)
x2 − x1 = 5 − 3 = 2
Divide rise by run
m = rise/run = 8/2 = 4
Positive slope: the line goes up from left to right.
Find the y-intercept
b = y1 − m × x1 = 7 − 4 × 3 = −5
This is where the line crosses the y-axis.
Write the equation of the line
y = 4x − 5
Slope-intercept form is y = mx + b.
Questions about slope
How do you find the slope from two points?
Subtract the y-values to get the rise, subtract the x-values in the same order to get the run, and divide rise by run. For (1, 2) and (4, 8): the rise is 8 − 2 = 6, the run is 4 − 1 = 3, and the slope is 6 ÷ 3 = 2.
Does it matter which point is first?
No, as long as you use the same order for both subtractions. Swapping the points changes the sign of the rise and of the run, and the two changes cancel when you divide.
What is the slope of a vertical line?
It is undefined. Both points have the same x-value, so the run is 0, and you cannot divide by zero. The equation of the line is x = that value.
What is the slope of a horizontal line?
Zero. Both points have the same y-value, so the rise is 0, and 0 divided by any run is 0. The equation of the line is y = that value.
How do you get the equation of the line from the slope?
Use y = mx + b. Put the slope in for m, then put one of the points in for x and y and solve for b. With slope 2 through (1, 2): 2 = 2 × 1 + b, so b = 0 and the line is y = 2x.
What does a negative slope mean?
The line goes down as you move from left to right: y gets smaller as x gets larger. A positive slope goes up from left to right.
How steep is a 6% slope?
A 6% slope rises 6 units for every 100 units across, a slope of 6 ÷ 100 = 0.06. Its angle with the horizontal is the inverse tangent of 0.06, about 3.43°. Over 50 feet of run it climbs 3 feet.
What is a 2% slope in degrees?
About 1.15°. A 2% slope rises 2 for every 100 across, a slope of 0.02, and the angle is the inverse tangent of that: tan⁻¹(0.02) ≈ 1.15°. A 1% slope is about 0.57° and a 5% slope about 2.86°.
Sources
- OpenStax Algebra and Trigonometry 2e, 2.2 Linear Equations in One Variable — the slope formula, slope-intercept form and the undefined slope of a vertical line (checked October 12, 2026)
- Wikipedia: Grade (slope) — slope as a percent grade (100 × rise ÷ run), as a ratio, and its angle (the inverse tangent) (checked October 16, 2026)