What this slope calculator finds
Slope, also called gradient, measures how steep a line is and which way it goes. This slope calculator works two ways. Enter two points to get the slope, the angle of incline, the distance between the points, and the equation of the line. Or enter one point, a slope (or angle), and a distance to find the two points that distance away along the line.
- A positive slope rises from left to right.
- A negative slope falls from left to right.
- A slope of 0 is a horizontal line.
- A vertical line has an undefined slope.
Slope formula: rise over run
For two points (x₁, y₁) and (x₂, y₂), the slope formula is
m = (y₂ − y₁) ÷ (x₂ − x₁) = ΔY ÷ ΔX
The top is the rise (vertical change) and the bottom is the run (horizontal change). If the run is 0, the line is vertical and the slope is undefined. The same two changes also give the distance and the angle:
- Distance: d = √(ΔX² + ΔY²), from the Pythagorean theorem
- Angle of incline: arctan(m), since m = tan(θ)
The calculator reports θ as the direction from the first point to the second, measured counterclockwise from the positive x-axis (0° to 360°). For a line going up and to the right, that is the angle of incline itself; going the other way adds 180°.
How to find slope from two points
- Subtract the y-values: 8 − 4 = 4 for the points (3, 4) and (6, 8).
- Subtract the x-values in the same order: 6 − 3 = 3.
- Divide rise by run: m = 4/3 ≈ 1.3333.
For the same points, the distance is √(3² + 4²) = 5 and the angle of incline is arctan(4/3) ≈ 53.13°. Subtracting in the opposite order on both top and bottom gives the same slope, but mixing the order flips the sign.
Slope-intercept form and point-slope form
Once you know the slope, you can write the equation of the line.
- Slope-intercept form: y = mx + b, where b is the y-intercept. For (3, 4) and (6, 8), b = 4 − (4/3)(3) = 0, so the line is y = (4/3)x.
- Point-slope form: y − y₁ = m(x − x₁). For the same line, y − 4 = (4/3)(x − 3).
The calculator shows both forms, plus the x-intercept (where y = 0) and the y-intercept (where x = 0). A vertical line is written as x = a number, because it has no slope-intercept form.
Finding a point from one point and the slope
If you know a point, the slope, and a distance d, the calculator finds the run and rise from the angle θ = arctan(m), adding 180° when the slope is negative: ΔX = d·cos(θ) and ΔY = d·sin(θ). Adding them to the starting point gives one answer, and subtracting them gives the point the same distance away in the opposite direction. You can enter the angle instead of the slope; an angle of 90° gives a vertical line. If you fill in both, the slope is used.
Frequently asked questions
How do you find the slope of a line?
Pick two points on the line, then divide the change in y by the change in x: m = (y₂ − y₁) ÷ (x₂ − x₁). If the line is already in the form y = mx + b, the slope is the number in front of x.
What is the slope of a vertical or horizontal line?
A horizontal line has a slope of 0 because y never changes. A vertical line has an undefined slope because x never changes, and dividing by zero is undefined.
How do you convert slope to an angle or a percent grade?
The angle is arctan(m). A slope of 1 is 45°, and a slope of 0.5 is about 26.57°. Percent grade, often used for roads and ramps, is the slope × 100, so a slope of 0.05 is a 5% grade.
Does the order of the points matter?
No, as long as you use the same order on top and bottom. Swapping both points gives (y₁ − y₂) ÷ (x₁ − x₂), which is the same number.
What's changed
- Launched with Two points known and One point and slope known tabs.
References
- Paul's Online Notes (Lamar University), Lines
the two-point slope formula, undefined slope of vertical lines, and the point-slope and slope-intercept forms