
Slope Calculator
Free slope calculator: find the slope of a line from two points with m = (y2-y1)/(x2-x1), plus the line equation, grade percentage and angle.
There was an error with your calculation.
| Slope | |
|---|---|
| Slope (m) | 1.75 |
| Angle (θ) | 1.05165rad or 60.25512° |
| Distance (d) | 8.062258 |
| Delta x (Δx) | 4 |
| Delta y (Δy) | 7 |
Slope at a glance#
The slope of a line, written m, measures its steepness and direction as rise over run: the vertical change divided by the horizontal change between two points. For points (x1, y1) and (x2, y2), the slope formula is m = (y2 minus y1) / (x2 minus x1).
Worked example: for the points (1, 2) and (4, 8), the rise is 8 minus 2, which is 6, and the run is 4 minus 1, which is 3. So m = 6 / 3 = 2. The line rises 2 units for every 1 unit it moves to the right.
The sign of the slope tells you the direction of the line. A positive slope rises from left to right, a negative slope falls from left to right, a zero slope is a flat horizontal line, and a vertical line has an undefined slope because the run (x2 minus x1) is zero and you cannot divide by zero.
Once you know the slope, you can write the line in slope-intercept form, y = mx + b, where m is the slope and b is the y-intercept, the y value where the line crosses the y-axis. For the example above, m = 2 and the line passes through (1, 2), which gives b = 0, so the equation is y = 2x.
Enter your two points in the calculator above to find the exact slope, the line equation, the incline angle and the distance between the points. Rounding can shift the last decimal place on angle and length values.
The slope formula#
Slope, written m, is rise over run: the vertical change divided by the horizontal change between two points. For points (x1, y1) and (x2, y2), m = (y2 − y1) / (x2 − x1). The result tells you how many units the line rises or falls for each unit it moves to the right.
Worked examples#
Slope between two points#
For (3, 4) and (7, 8): m = (8 − 4) / (7 − 3) = 4 / 4 = 1. A slope of 1 means the line rises one unit for every unit it moves right, a 45-degree incline.
Slope as a grade#
If a road climbs from 100 m to 120 m of elevation over 500 m of distance, the slope is (120 − 100) / 500 = 20 / 500 = 0.04, or 4%. Civil engineers express slope as this percentage of rise per 100 units of horizontal distance.
Types of slope#
The sign and value of the slope describe the line. A positive slope rises from left to right; a negative slope falls. A zero slope is a flat horizontal line, because the rise is zero. A vertical line has an undefined slope, because the run (x2 − x1) is zero and dividing by zero is not defined.
From slope to a line equation#
Once you have the slope, you can write the line in slope-intercept form, y = mx + b, where b is the y-intercept, the y value where the line crosses the y-axis. Substitute the slope and one known point to solve for b. For m = 1 through (3, 4): 4 = 1 × 3 + b, so b = 1 and the line is y = x + 1.
Frequently asked questions#
How do I find the slope between two points?#
Subtract the y values for the rise, subtract the x values for the run, then divide: m = (y2 − y1) / (x2 − x1). For (1, 2) and (4, 8), m = (8 − 2) / (4 − 1) = 6 / 3 = 2.
What does a zero slope mean?#
The line is horizontal. Both points share the same y value, so the rise is zero and m = 0. The line stays level and never goes up or down.
Why is a vertical line undefined?#
Both points share the same x value, so the run (x2 − x1) is zero. Division by zero has no value, so the slope of a vertical line is undefined rather than infinite.
What does a negative slope mean?#
The line falls from left to right: as x increases, y decreases. It happens when the rise is negative while the run is positive, for example a slope of −2.
How do I find the y-intercept from the slope?#
Put the slope and one point into y = mx + b and solve for b. With m = 2 through (1, 2): 2 = 2 × 1 + b, so b = 0 and the line is y = 2x.
How do I convert slope to a percentage?#
Multiply the slope by 100. A slope of 0.04 is a 4% grade, meaning a 4-unit rise over 100 units of horizontal distance. Grades are common in road and ramp design.