Slope Calculator: Slope, Angle and Line Equation
Enter two points on a line to get its slope, its angle in degrees and its equation.
Updated
Report a problem
Formula
m = (y2 - y1) / (x2 - x1)b = y1 - m × x1, line:y = mx + bangle = atan(m)in degrees
Worked example
Points (1, 2) and (3, 6): m = (6 - 2) / (3 - 1) = 2, b = 2 - 2 × 1 = 0, so the line is y = 2x and the angle is atan(2) = 63.4349 degrees.
Frequently asked questions
How do I find the slope between two points?
Divide the change in y by the change in x: m = (y2 - y1) ÷ (x2 - x1). For (1, 2) and (3, 6) that is 4 ÷ 2 = 2.
How do I get the equation of the line?
Use y = mx + b, then b = y1 - m × x1. For (1, 2) with m = 2, b = 2 - 2 = 0, so the line is y = 2x.
What if the line is vertical?
If both x values are equal, the change in x is zero and the slope is undefined, so the calculator reports a divide by zero. The line is simply x = that value.
How is the angle calculated?
The angle with the x axis is the arctangent of the slope. A slope of 2 gives atan(2) = 63.4349 degrees; a negative slope gives a negative angle.