General Math
Slope Calculator: Find the Gradient and Equation of a Line
Learn how to calculate the slope of a line from two points, find the y-intercept and equation, and interpret positive, negative and undefined slopes.
Try it now
Slope Calculator
Calculate the slope, angle and equation of a line from two points.
Slope Calculator: Find the Gradient and Equation of a Line
Slope is the number that captures how steep a line is and which way it tilts. It is fundamental to algebra, geometry, physics, and any field that models relationships as straight lines. A slope calculator takes two points and instantly gives you the slope, the angle, the y-intercept, and the full equation of the line.
What Is Slope?
Slope, often written as m, measures the rate of change of a line — how much the vertical value (y) changes for each unit of horizontal change (x). It is commonly described as “rise over run.”
Slope m = (y₂ − y₁) ÷ (x₂ − x₁)
- A positive slope rises from left to right.
- A negative slope falls from left to right.
- A zero slope is a flat, horizontal line.
- An undefined slope is a vertical line (the run is zero, and you cannot divide by zero).
From Slope to the Equation of a Line
Once you know the slope and one point, you can write the line in slope-intercept form:
y = mx + b
where b is the y-intercept — the value of y where the line crosses the y-axis (x = 0). You find it with:
b = y₁ − m · x₁
A Worked Example
Find the line through (1, 2) and (4, 11):
- Slope: m = (11 − 2) ÷ (4 − 1) = 9 ÷ 3 = 3
- Y-intercept: b = 2 − 3 × 1 = −1
- Equation: y = 3x − 1
You can verify by plugging in x = 4: y = 3 × 4 − 1 = 11. ✓
The Angle of a Slope
Slope also corresponds to an angle of inclination — the angle the line makes with the horizontal:
θ = arctan(m)
A slope of 1 corresponds to a 45° angle; a slope of 3 corresponds to about 71.6°. This is useful in construction, ramps, and road-grade calculations.
How to Use the Slope Calculator
- Enter the coordinates of the first point, (x₁, y₁).
- Enter the coordinates of the second point, (x₂, y₂).
- The calculator returns the slope, the line equation, the y-intercept, the angle, and the distance between the two points.
Where Slope Is Used
- Physics: velocity is the slope of a distance–time graph.
- Economics: marginal cost and demand curves rely on slope.
- Construction: roof pitch, ramp gradients, and road grades are slopes.
- Data science: the coefficient in linear regression is a slope.
Common Mistakes to Avoid
- Mixing up the order of the points. As long as you subtract the y-values and x-values in the same order, the slope is correct. Reversing only one of them flips the sign.
- Dividing by zero. If x₂ = x₁, the line is vertical and the slope is undefined — not zero.
- Confusing zero slope with undefined slope. Horizontal lines have slope 0; vertical lines have undefined slope.
- Forgetting the sign. A negative slope is just as valid as a positive one and describes a line going downhill.
Conclusion
Slope distils the direction and steepness of a line into a single number, and from it you can derive the y-intercept, the equation, and the angle. Whether you are graphing a function, analysing data, or designing a ramp, a slope calculator gives you every key property of a line from just two points.
Try our free Slope Calculator for instant results.
OurDailyCalc Team
OurDailyCalc — beautiful tools for everyday calculations.