How this slope calculator works
The slope of a line measures its steepness and direction. Given any two points on the line, you find the slope by dividing the rise — the change in y — by the run — the change in x. In symbols, m = (y2 − y1) / (x2 − x1). A positive slope rises from left to right, a negative slope falls, a slope of zero is a flat horizontal line, and a vertical line has an undefined slope because its run is zero.
Once you have the slope, you can write the line in slope-intercept form, y = mx + b. The y-intercept b is found by rearranging: b = y − m·x for either known point. This calculator also reports the angle of incline (the arctangent of the slope, in degrees), the straight-line distance between the two points, and their midpoint.
Reference note: the angle of incline is computed as atan(m) and reported in degrees. When both x-values are equal the line is vertical, the slope is undefined and there is no slope-intercept equation; when both y-values are equal the slope is exactly zero.
Frequently asked questions
- What is slope?
- Slope measures how steep a line is. It is the ratio of the vertical change to the horizontal change between two points, often described as rise over run. A larger absolute value means a steeper line.
- How do I find slope from two points?
- Use the formula m = (y2 − y1) / (x2 − x1). Subtract the first y from the second y to get the rise, subtract the first x from the second x to get the run, then divide. The points (1, 2) and (3, 8) give m = 6 / 2 = 3.
- What is slope-intercept form?
- Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept — the y-value where the line crosses the y-axis. Knowing the slope and one point lets you solve for b and write the line's equation.
- What does a negative slope mean?
- A negative slope means the line goes downward from left to right: as x increases, y decreases. A positive slope rises, a slope of zero is horizontal, and an undefined slope is a vertical line.
- What is the slope of a vertical line?
- A vertical line has an undefined slope. Both points share the same x-value (x1 = x2), so the run is zero and division by zero is not allowed. There is no slope-intercept equation for it.
- How do I find the y-intercept?
- After finding the slope m, plug one point (x, y) into y = mx + b and solve b = y − m·x. For (1, 2) and (3, 8) the slope is 3, so b = 2 − 3·1 = −1 and the equation is y = 3x − 1.