Understanding the slope calculator — concept and principle
This calculator finds the slope of the line through two points, its equation, the angle of inclination, the grade in percent, the y-intercept, the perpendicular slope and the distance between the points. Use it for algebra and coordinate geometry, for ramps, roofs and roads, and for reading rates of change from data.
How it is calculated
- Slope m = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁).
- Equation: y = m·x + b with b = y₁ − m·x₁.
- Angle of inclination = arctan(m), from the positive x-axis (0–180°).
- Grade (%) = m × 100.
- Perpendicular slope = −1 ÷ m.
- Distance = √(Δx² + Δy²).
A vertical line (x₁ = x₂) has no defined slope; a horizontal line has slope 0.
The principle
A straight line rises by the same amount for every unit it moves to the right, and that constant rate is the slope. Any two points on the line give the same ratio, because the triangles formed by rise and run are similar. The slope is the tangent of the angle the line makes with the x-axis. Two lines are perpendicular when the product of their slopes is −1, since turning a direction by 90° swaps rise and run and changes one sign.
Worked example
Default inputs: (1, 2) and (5, 10).
- Rise Δy = 10 − 2 = 8; run Δx = 5 − 1 = 4.
- Slope m = 8 ÷ 4 = 2.
- b = 2 − 2 × 1 = 0, so the equation is y = 2x.
- Angle = arctan 2 ≈ 63.43494882°; grade = 200%.
- Perpendicular slope = −0.5; distance = √(4² + 8²) = √80 ≈ 8.94427191.
| x₂ | Slope m |
|---|---|
| 1.25 | 32 |
| 2.5 | 5.333333333 |
| 3.75 | 2.909090909 |
| 5 | 2 |
| 6.25 | 1.523809524 |
| 7.5 | 1.230769231 |
| 10 | 0.8888888889 |
How to read the result
A positive slope rises from left to right; a negative slope falls. The size tells you how steep: slope 1 is 45°, slope 2 is about 63°. Grade is how roads and ramps are usually described: a 200% grade is very steep, while road grades are usually a few percent. In data, the slope is the change in y per unit of x, with units such as km per hour.
Common mistakes
- Subtracting in a different order on top and bottom, such as (y₂ − y₁) ÷ (x₁ − x₂).
- Confusing grade (%) with angle (°); a 100% grade is 45°, not 90°.
- Dividing by zero for a vertical line instead of calling the slope undefined.
- Swapping x and y coordinates of a point.
Frequently asked questions
How do I convert slope to degrees?
Take the arctangent: angle = arctan(m). Slope 1 is 45°.
What is the slope of a horizontal line?
0, because the rise is zero.
What does a slope of −0.5 mean?
The line drops 0.5 units for every 1 unit to the right.
Sources: OpenStax, College Algebra 2e, §4.1 Linear Functions