Slope Calculator
This slope calculator finds the slope of a line from two points, from a point and a slope, from an equation, or from a rise and a run. It also converts between slope, percent grade, degrees and a 1 : n ratio, and finds a missing coordinate. Every answer comes with a graph, a step-by-step solution and a check of the result, and no signup is needed.
Calculation
Slope from two points
Formula
Step-by-Step Solution
Graph of the line
Given
Formula
Step-by-step working
Check your answer
Final summary
How to Use This Slope Calculator
- Pick a tab. Two points gives the slope and the full line equation, Point and slope builds the equation from one point, From equation reads the slope from y = mx + b or Ax + By = C, and Rise and run is for ramps, roofs and roads.
- Convert grade switches between slope, percent grade, degrees and a 1 : n ratio. Missing point finds x₂ or y₂ when you know the slope.
- Type your numbers. Whole numbers, decimals and fractions such as 1/2 all work. In the Missing point tab you can type a slope as a percent, such as 12%.
- Click Calculate or press Enter. The Step-by-Step Solution box opens directly under the inputs, with a graph of the line.
- Follow the numbered steps and the Check your answer line, then use Copy result or Download PDF to keep the working.
- Click Reset to clear the inputs and start again.
Slopes that are whole numbers or fractions are found exactly, so 6 over 4 is shown as 3/2 and not as a rounded decimal. Angles and some distances are rounded to 10 significant digits and marked with the ≈ sign.
What the Step-by-Step Solution Shows
After you press Calculate, the answer box shows the method as well as the number.
- The answer: the slope as an exact fraction, or the equation of the line, with the decimal alongside.
- Key values: slope-intercept and standard form, both intercepts, the angle, the percent grade, the 1 : n ratio, the distance and the midpoint where they apply.
- A graph: the line with your points marked, and the rise and run drawn as a dashed triangle for two points.
- Numbered steps: each step has a short title and a one-line reason.
- Check your answer: your points put back into the equation, or the slope worked backward.
- Copy result and Download PDF: Copy gives plain text for notes, and Download PDF gives a file for homework.
What Is Slope?
Slope tells you how steep a line is and which way it leans. You find it by comparing how far the line moves up or down, the rise, with how far it moves across, the run. A line that rises 3 units while running 4 units has a slope of 3/4.
Different fields use different words for the same idea. Maths classes say slope or gradient, builders say pitch, and road engineers say grade. The slope is also the rate of change: the slope of a distance-time graph is speed, and the slope of a cost graph is the price per unit.
Slope Formula
- m: the slope of the line
- (x₁, y₁) and (x₂, y₂): any two different points on the line
- Order matters: subtract in the same order on the top and the bottom. Swapping both gives the same slope.
- Angle: m = tan(θ), so the angle of incline is θ = tan−1(m)
Types of Slope
| Slope | What the line does | Example |
|---|---|---|
| Positive (m > 0) | Rises from left to right | y = 2x + 1 |
| Negative (m < 0) | Falls from left to right | y = −x + 4 |
| Zero (m = 0) | Flat, a horizontal line | y = 3 |
| Undefined | Straight up and down, a vertical line | x = 5 |
How to Find the Slope of a Line
- Pick two different points on the line and label them (x₁, y₁) and (x₂, y₂).
- Find the rise by subtracting the y values: y₂ − y₁.
- Find the run by subtracting the x values in the same order: x₂ − x₁.
- Divide the rise by the run, and simplify the fraction.
- Check the sign. If the line rises to the right the slope must be positive, and if it falls the slope must be negative.
If the run is 0, the line is vertical and the slope is undefined. If the rise is 0, the line is horizontal and the slope is 0.
Slope From an Equation
When a line is written in slope-intercept form, y = mx + b, the slope is the number in front of x and b is where the line crosses the y-axis. In standard form, Ax + By = C, solve for y to get y = (−A/B)x + C/B, so the slope is −A/B.
Example: 3x + 4y = 12. Here A = 3 and B = 4, so the slope is −3/4. Solving for y gives y = −(3/4)x + 3, so the y-intercept is 3 and the x-intercept is 4.
Parallel and Perpendicular Lines
- Parallel lines never meet and have the same slope. A line parallel to y = 2x + 5 also has slope 2.
- Perpendicular lines meet at a right angle. Their slopes multiply to −1, so each is the negative reciprocal of the other: 2 and −1/2, or 3/4 and −4/3.
- A horizontal line (slope 0) is perpendicular to a vertical line (undefined slope).
Slope, Percent Grade, Degrees and Ratio
Slope can be written four ways. Roads and ramps use a percent or a 1 : n ratio, and surveying uses degrees. They all describe the same steepness.
| Ratio (rise : run) | Slope | Percent grade | Angle |
|---|---|---|---|
| 1 : 20 | 0.05 | 5% | 2.86° |
| 1 : 12 | 0.0833 | 8.33% | 4.76° |
| 1 : 10 | 0.1 | 10% | 5.71° |
| 1 : 8 | 0.125 | 12.5% | 7.13° |
| 1 : 6 | 0.1667 | 16.67% | 9.46° |
| 1 : 4 | 0.25 | 25% | 14.04° |
| 1 : 2 | 0.5 | 50% | 26.57° |
| 1 : 1 | 1 | 100% | 45° |
Degrees to percentage: percent = 100 × tan(angle). Percentage to degrees: angle = tan−1(percent / 100). Note that 100% is 45 degrees, not 90 degrees, and a vertical line has an infinite grade. The Convert grade tab does either conversion for you.
Ramp, Roof and Road Slopes
- Ramps: the common accessibility limit for a ramp is 1:12, which is an 8.33% slope. A rise of 30 inches then needs a run of 360 inches, or 30 feet. Check your local code for the exact rules.
- Roofs: pitch is usually written as rise over 12 units of run. A 6/12 pitch is a slope of 0.5, a 50% grade and an angle of 26.57 degrees.
- Roads: signs show a percent grade. A 7% grade rises 7 metres for every 100 metres travelled horizontally.
- Drainage: a fall of 1 in 80 is a slope of 1.25%. Use the Rise and run tab with a rise of 1 and a run of 80.
Worked Examples, Step by Step
Example 1: Slope between two points
Find the slope of the line through (1, 2) and (4, 8).
- Rise: 8 − 2 = 6
- Run: 4 − 1 = 3
- Slope: 6 / 3 = 2
- y-intercept: b = 2 − 2 × 1 = 0, so the line is y = 2x
Example 2: A negative slope
Find the slope through (−2, 5) and (4, −1).
- Rise: −1 − 5 = −6
- Run: 4 − (−2) = 6
- Slope: −6 / 6 = −1
- The line falls at 45 degrees. Its equation is y = −x + 3.
Example 3: A wheelchair ramp
A doorway is 30 inches above the ground and the ramp is 360 inches long on the ground. Is it a 1:12 ramp?
- Slope = rise / run = 30 / 360 = 1/12
- Percent grade = 100 × 1/12 = 8.33%
- Angle = tan−1(1/12) = 4.76 degrees
Example 4: Percent grade to degrees
A road sign shows an 8% grade. What is the angle?
- Slope = 8 / 100 = 0.08
- Angle = tan−1(0.08) = 4.57 degrees
- Ratio = 1 / 0.08 = 12.5, so it is a 1 : 12.5 slope
Common Mistakes When Finding Slope
- Mixing the order: using y₂ − y₁ on top but x₁ − x₂ on the bottom flips the sign.
- Run over rise: the slope is rise divided by run, not the other way round.
- Dropping a negative sign when subtracting a negative coordinate. Subtracting −2 adds 2.
- Treating percent as degrees: a 100% grade is 45 degrees, not 100 degrees.
- Mixed units: rise and run must be in the same unit before you divide.
Limits and Rounding
Inputs can have up to 15 digits and a power of 10 from −100 to 100. Slopes, intercepts and equations are worked out exactly with fractions. Angles come from the inverse tangent and are rounded to 10 significant digits. Distances that are not whole numbers are shown as a rounded decimal. The equation box accepts linear equations in x and y only, without brackets.
Frequently Asked Questions
- What is slope?
- Slope is a number that measures how steep a line is. It is the rise (vertical change) divided by the run (horizontal change). A slope of 2 means the line goes up 2 units for every 1 unit it moves to the right.
- What is the slope formula?
- The slope formula is m = (y₂ − y₁) / (x₂ − x₁). Subtract the y values for the rise, subtract the x values for the run in the same order, then divide.
- How do I find the slope of a line from two points?
- Write the points as (x₁, y₁) and (x₂, y₂), subtract to get the rise and the run, then divide. For (1, 2) and (4, 8) the rise is 6, the run is 3, and the slope is 2. The Two points tab shows each step.
- What does a negative, zero or undefined slope mean?
- A negative slope falls from left to right. A slope of 0 is a flat, horizontal line. An undefined slope belongs to a vertical line, because the run is 0 and you cannot divide by 0.
- How do I convert slope to percent grade?
- Multiply the slope by 100. A slope of 0.08 is an 8% grade, and a rise of 1 over a run of 12 is 8.33%. Use the Convert grade tab to switch between slope, percent, degrees and ratio.
- How do I convert degrees to percentage?
- Take the tangent of the angle and multiply by 100. For 10 degrees, tan(10°) is about 0.1763, so the grade is about 17.63%. To go from percent to degrees, divide by 100 and take the inverse tangent.
- What does a 1:12 slope mean?
- A 1:12 slope rises 1 unit for every 12 units of run. That is a slope of 1/12, a grade of 8.33% and an angle of about 4.76 degrees. It is the usual maximum for wheelchair ramps.
- How do I find the slope from an equation?
- If the equation is in the form y = mx + b, the slope is the number in front of x. For Ax + By = C, the slope is −A / B. The From equation tab accepts both forms.
- How do I find the slope of a parallel or perpendicular line?
- A parallel line has the same slope. A perpendicular line has the negative reciprocal slope, so a slope of 2 becomes −1/2. The From equation tab shows both.
- Is slope the same as gradient?
- Yes. Slope and gradient mean the same thing for a straight line. Gradient is more common in the UK, and slope is more common in the US. Roads and ramps often use the word grade for the same value written as a percent.