How to use this slope calculator
This slope calculator has four modes. Pick the one that matches what you know. The results update as you type, and you can use whole numbers, decimals, negative numbers, and fractions.
Two points
Type the coordinates of two points on the line, (x₁, y₁) and (x₂, y₂). You get the slope, the line equation, both intercepts, the distance, the midpoint, the angle, and the percent grade.
Point and slope
Type one point and the slope. The tool builds the full equation of the line in three forms and shows where the line crosses each axis.
Equation
Type a line equation such as y = 2x + 1 or 3x + 2y = 12. The tool finds the slope and the intercepts and shows how it solved for y.
Grade and angle
Type a ratio, a slope, a percent grade, or an angle. The tool converts it to all the others. This is helpful for ramps, roofs, roads, and trails.
Slope formula: rise over run
Slope measures how steep a line is and which way it leans. It is often written as m. To find it, divide the vertical change (the rise) by the horizontal change (the run).
The sign and size of the slope tell you what the line looks like:
- m > 0: the line rises from left to right.
- m < 0: the line falls from left to right.
- m = 0: the line is horizontal. The rise is 0.
- Undefined: the line is vertical. The run is 0, and you cannot divide by 0.
- The larger the absolute value of m, the steeper the line.
How to find the slope from two points
Follow these steps. We will use the points (2, 1) and (8, 5).
- Step 1: Find the rise. Δy = y₂ − y₁ = 5 − 1 = 4.
- Step 2: Find the run. Δx = x₂ − x₁ = 8 − 2 = 6.
- Step 3: Divide. m = 4 ÷ 6 = 2/3, which is about 0.6667.
Use the same order for both points every time. If you subtract y in one order and x in the other, the sign of the slope will be wrong.
Slope-intercept, point-slope, and standard form
Once you know the slope, you can write the equation of the line in three common forms. Here they are for the same line as above, which has a slope of 2/3 and passes through (2, 1).
| Form | Pattern | Example |
|---|---|---|
| Slope-intercept | y = mx + b | y = (2/3)x − 1/3 |
| Point-slope | y − y₁ = m(x − x₁) | y − 1 = (2/3)(x − 2) |
| Standard | Ax + By = C | 2x − 3y = 1 |
To get the y-intercept b, use b = y₁ − m × x₁. Here, b = 1 − (2/3)(2) = −1/3. To reach standard form, multiply every term by the common denominator so that no fractions are left. Here, multiply by 3 to get 3y = 2x − 1, which becomes 2x − 3y = 1.
How to find slope from an equation
If the equation is in slope-intercept form, y = mx + b, the slope is the number in front of x. For y = 3x − 6, the slope is 3.
If the equation is in standard form, Ax + By = C, the slope is −A ÷ B. For 3x + 2y = 12, the slope is −3/2. You can also solve for y: 2y = −3x + 12, so y = (−3/2)x + 6.
Slope as percent grade, angle, and ratio
People describe steepness in different ways, but they all come from the same number. Use these rules to switch between them:
- Percent grade = slope × 100
- Angle = tan−1(slope), in degrees
- Slope = tan(angle)
- Ratio 1 : x means the slope is 1 ÷ x
| Ratio (rise : run) | Slope | Percent grade | Angle |
|---|---|---|---|
| 1:1 | 1 | 100% | 45° |
| 1:2 | 0.5 | 50% | 26.57° |
| 1:3 | 0.3333 | 33.33% | 18.43° |
| 1:4 | 0.25 | 25% | 14.04° |
| 1:5 | 0.2 | 20% | 11.31° |
| 1:8 | 0.125 | 12.5% | 7.13° |
| 1:10 | 0.1 | 10% | 5.71° |
| 1:12 | 0.0833 | 8.33% | 4.76° |
| 1:20 | 0.05 | 5% | 2.86° |
| 1:50 | 0.02 | 2% | 1.15° |
A 1:12 slope is the maximum running slope that the ADA allows for most wheelchair ramps. It equals an 8.33% grade, or about 4.76 degrees.
Roof pitch
Roof pitch is written as rise over 12 inches of run. A 6/12 roof rises 6 inches for every 12 inches of horizontal distance.
| Roof pitch | Rise : run | Slope | Percent grade | Angle |
|---|---|---|---|---|
| 2/12 | 2:12 | 0.1667 | 16.67% | 9.46° |
| 3/12 | 3:12 | 0.25 | 25% | 14.04° |
| 4/12 | 4:12 | 0.3333 | 33.33% | 18.43° |
| 5/12 | 5:12 | 0.4167 | 41.67% | 22.62° |
| 6/12 | 6:12 | 0.5 | 50% | 26.57° |
| 8/12 | 8:12 | 0.6667 | 66.67% | 33.69° |
| 10/12 | 10:12 | 0.8333 | 83.33% | 39.81° |
| 12/12 | 12:12 | 1 | 100% | 45° |
Parallel and perpendicular lines
Parallel lines never meet, and they have the same slope. Perpendicular lines meet at a 90 degree angle, and their slopes are negative reciprocals. To find a perpendicular slope, flip the fraction and change the sign. If the slope is 2/3, the perpendicular slope is −3/2. A horizontal line (slope 0) is perpendicular to a vertical line.
x-intercept and y-intercept
The y-intercept is where the line crosses the y-axis, so x = 0. In y = mx + b, it is simply b. The x-intercept is where the line crosses the x-axis, so y = 0. To find it, solve 0 = mx + b, which gives x = −b ÷ m. A horizontal line has no x-intercept unless it is the x-axis itself. A vertical line has no y-intercept unless it is the y-axis itself.
Where slope is used in real life
- Roofs and stairs: builders describe steepness with rise over run.
- Ramps and accessibility: ramp slopes are limited so people can use them safely.
- Roads and trails: a 10% grade rises 10 feet for every 100 feet of horizontal distance.
- Science and business: the slope of a graph is a rate of change, such as speed on a distance-time graph or cost per item on a price graph.
- Calculus: the derivative of a function at a point is the slope of the tangent line at that point.
Slope terms explained
- Slope (gradient)
- A number that tells how steep a line is and which way it leans.
- Rise
- The vertical change between two points, written as Δy.
- Run
- The horizontal change between two points, written as Δx.
- y-intercept
- The point where the line crosses the y-axis.
- x-intercept
- The point where the line crosses the x-axis.
- Slope-intercept form
- The equation y = mx + b, where m is the slope and b is the y-intercept.
- Point-slope form
- The equation y − y₁ = m(x − x₁), built from one point and the slope.
- Standard form
- The equation Ax + By = C, usually with whole numbers.
- Undefined slope
- The slope of a vertical line, because the run is 0.
- Percent grade
- Slope written as a percent, which is the slope times 100.