Slope Calculator guide
Slope Calculator: Gradient and Equation of a Line
Use our slope calculator to find the slope (gradient) of a line through two points, its equation, angle, intercepts and midpoint.
By the AllCalculator editorial teamUpdated 16 October 20261 min read
The slope, or gradient, of a line tells you how steep it is. Our Slope Calculator works it out from any two points and gives you the equation of the line.
How to use the calculator (Slope Calculator)
Enter the coordinates of two points, (x₁, y₁) and (x₂, y₂). You'll see:
- The slope and the equation of the line in y = mx + c form
- The y-intercept and x-intercept
- The angle to the x-axis and the grade as a percentage
- The distance between the points and the midpoint
- The slope of a perpendicular line
The formula
m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
Then c = y₁ − m × x₁.
A worked example
With the calculator's default settings, points (1, 2) and (5, 10):
- Rise: 10 − 2 = 8
- Run: 5 − 1 = 4
- Slope: 8 ÷ 4 = 2
- Equation: y = 2x
- Angle: 63.43°
What the slope tells you
| Slope | Line |
|---|---|
| Positive | Goes up from left to right |
| Negative | Goes down from left to right |
| Zero | Horizontal |
| Undefined | Vertical |
Frequently asked questions
What's the difference between slope and grade?
Grade is the slope as a percentage. A slope of 0.1 is a 10% grade, which is how road signs show steep hills.
How do I know if two lines are perpendicular?
Their slopes multiply to −1. A line with a slope of 2 is perpendicular to one with a slope of −½.
What if both points have the same x?
The line is vertical, and its slope is undefined.
For the distance between points in 3D or on a map, use our Distance Calculator.
Sources and further reading
- GOV.UK: National curriculum in England – mathematicsgov.uk
- Wolfram MathWorld: Slopemathworld.wolfram.com
Links open official and independent websites in a new tab.
This guide is general information to help you understand your options. It isn't financial, tax, legal or building advice and doesn't take your personal circumstances into account. Figures were checked when the guide was last updated and can change, so confirm anything important with GOV.UK, HMRC, a regulated adviser or a qualified tradesperson.