Enter two points to get the slope (rise over run), the equation of the line, its angle, the distance between the points and the midpoint.
The slope formula
m = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁)
Slope measures steepness: how much y changes for every 1 step in x. From (1, 2) to (4, 8) the rise is 6 and the run is 3, so the slope is 2: the line goes up 2 for every 1 across.
- Positive slope: the line goes up from left to right.
- Negative slope: it goes down.
- Zero slope: a flat, horizontal line (y = a number).
- Undefined slope: a vertical line (x = a number), because the run is zero.
Slope-intercept form
Once you know the slope m, find b, the point where the line crosses the y-axis, with b = y₁ − m·x₁. The line is then y = mx + b. For the example above, b = 2 − 2 × 1 = 0, so the line is y = 2x.
Slope as an angle or a grade
The angle of the line is arctan(m). A road's grade is the slope as a percent: a 6% grade rises 6 feet for every 100 feet. Roofers describe pitch as rise over a 12-inch run, so a 6/12 roof has a slope of 0.5 (about 26.6°).
How we checked this
Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:
- (1, 2) to (4, 8): slope 2, y = 2x ✓
- (2, 1) to (2, 5): vertical, undefined ✓
Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.
Questions people ask
What is rise over run?
The vertical change between two points (rise) divided by the horizontal change (run). It's the same thing as slope.
What does a slope of 0 mean?
The line is horizontal. Both points have the same y value.
Why is the slope undefined?
Both points have the same x value, so the run is 0, and dividing by zero is undefined. The line is vertical.
Does the order of the points matter?
No. Swapping the points flips the sign of both the rise and the run, so the slope stays the same.