Enter two points (x₁, y₁) and (x₂, y₂) to find the slope of the straight line through them — how steeply it rises or falls. You also get the line’s equation in slope-intercept form, its angle to the x-axis, the intercepts and the distance between the points.
Slope is rise over run: how much a line goes up for every unit it goes across. The same number shows up as a road’s percent grade, a roof’s pitch and a wheelchair ramp’s gradient, so the calculator gives the angle as well.
What is slope?
The slope of a line measures its steepness and direction: how much y changes for every one-unit change in x. It is usually written m and calculated as rise over run — the vertical change between two points divided by the horizontal change.
A line with slope 2 climbs two units for each unit to the right; slope −½ falls half a unit. A horizontal line has slope 0, and a vertical line has no defined slope because its run is zero. Parallel lines have equal slopes, and perpendicular lines have slopes that multiply to −1.
Slope is the same idea as a rate of change. Speed is the slope of a distance–time graph, a road’s grade is its slope as a percentage, and in calculus the derivative is the slope of a curve at a point.
How to use the slope calculator
- Enter the coordinates of two points on the line.
- Read the slope, the angle and the equation of the line.
- Use the equation shown to find other points on the line.
Formula
m = (y₂ − y₁) ÷ (x₂ − x₁)
Slope is rise over run: the change in y divided by the change in x. A positive slope rises from left to right, a negative slope falls, a slope of 0 is horizontal and a vertical line has an undefined slope.
The y-intercept is b = y₁ − m·x₁, giving the equation y = mx + b. The angle to the x-axis is arctan(m).
Worked examples
A falling line
- x₁
- -2
- y₁
- 7
- x₂
- 4
- y₂
- -2
- Slope (m)
- -1.5
- Equation
- y = −1.5x + 4
- y-intercept (b)
- 4
Rise = −2 − 7 = −9 and run = 4 − (−2) = 6, so m = −9 ÷ 6 = -1.5. Then b = 7 − (−1.5)(−2) = 4, giving y = −1.5x + 4.
Speed from a distance–time graph
- x₁
- 0
- y₁
- 0
- x₂
- 2.5
- y₂
- 150
- Slope (m)
- 60
- Equation
- y = 60x
- y-intercept (b)
- 0
A car is at 0 km at time 0 and 150 km after 2.5 hours. The slope, 60 km per hour, is its average speed.
Slope, angle and grade
| Slope (m) | Angle to the x-axis | Grade | Meaning |
|---|---|---|---|
| 0 | 0° | 0% | Horizontal |
| 0.05 | 2.86° | 5% | Gentle road incline |
| 0.5 | 26.57° | 50% | Rises 1 for every 2 across |
| 1 | 45° | 100% | Rises as fast as it moves across |
| 2 | 63.43° | 200% | Steep |
| -1 | -45° | -100% | Falls as fast as it moves across |
Slope as grade, pitch and angle
A road sign showing an 8% grade means a slope of 0.08: 8 m of climb per 100 m across, an angle of about 4.6°. A roof pitched 6 in 12 rises 6 inches per foot, a slope of 0.5 or about 26.6°. Converting between them is the same calculation each time.
Common mistakes
- Mixing the order of the points: (y₂ − y₁) ÷ (x₁ − x₂) gives the wrong sign. Subtract in the same order on the top and bottom.
- Putting x on top. Slope is the change in y over the change in x, not the other way round.
- Calling a vertical line’s slope zero. Horizontal lines have slope 0; vertical lines have an undefined slope.
- Dividing run by rise. Slope is the change in y divided by the change in x.
Frequently asked questions
Does it matter which point I call the first one?
No. Swapping the points flips the sign of both the rise and the run, so their ratio — the slope — stays the same.
Why is the slope of a vertical line undefined?
Both points have the same x, so the run is 0 and the formula would divide by zero. The line’s equation is simply x = constant.
How is slope related to a percent grade?
Multiply the slope by 100. A slope of 0.05 is a 5% grade — the line rises 5 units for every 100 units across.
What is slope-intercept form?
y = mx + b, where m is the slope and b is where the line crosses the y-axis. Once you know the slope, substitute one point to find b.
Sources
- Slope, Wolfram MathWorld
- Elementary Algebra 2e, 4.4: Understand Slope of a Line, OpenStax, Rice University
Last updated · Calculations checked by automated tests· Editorial policy