Slope Calculator

Enter two points (x1, y1) and (x2, y2) to find the slope of the line through them.

Slope m-
Equation-
Angle-
Distance-

How to find the slope

Slope is rise over run: m = (y2 - y1) / (x2 - x1). Subtract the y values to get the rise, subtract the x values to get the run, then divide. Once you have m, the y-intercept is b = y1 - m x x1, which gives the line equation y = mx + b. A positive slope rises left to right, a negative slope falls, a slope of 0 is a flat horizontal line, and when x1 = x2 the line is vertical and the slope is undefined.

Worked examples

Point 1Point 2SlopeLine
(1, 2)(4, 8)2y = 2x + 0
(0, 0)(5, 10)2y = 2x + 0
(-2, 3)(4, -3)-1y = -1x + 1
(2, 5)(6, 5)0y = 0x + 5
(3, 1)(3, 7)undefinedx = 3

FAQ

What is the slope formula?

m = (y2 - y1) / (x2 - x1), the change in y divided by the change in x between two points on the line.

What is the slope of a vertical line?

Undefined, because the run (x2 - x1) is zero and you cannot divide by zero. A vertical line has the equation x = a number.

What is the slope of a horizontal line?

Zero. The rise is zero, so m = 0 and the equation is y = a number.

How do I turn slope into an angle?

The angle with the x-axis is arctan(m). A slope of 1 is 45 degrees; a slope of 0.5 is about 26.57 degrees.

See also: midpoint calculator · distance between two points · pythagorean theorem calculator · quadratic equation solver · all tools