Slope Calculator
Calculate the slope and equation of a line through two points.
Standard
Math
Calculator Inputs
Your Result
Enter your details and press Calculate to see your result.
Formula
Slope = (y₂ − y₁) ÷ (x₂ − x₁)
y₂
y₁
x₂
x₁
How it works
- Enter the coordinates of two points on the line.
- View the slope and the equation of the line.
Share on Social Media:
The slope of a line is how much it rises for each unit it moves to the right: m = (y₂ − y₁) ÷ (x₂ − x₁), or "rise over run". Enter two points and this calculator gives the slope and the equation of the line through them in slope-intercept form, y = mx + b.
How it's calculated
- Slope: m = (y₂ − y₁) ÷ (x₂ − x₁)
- Y-intercept: b = y₁ − m × x₁ (where the line crosses the y-axis)
- Equation: y = mx + b
Worked examples
- (0, 0) and (4, 8): m = 8 ÷ 4 = 2, b = 0. Line: y = 2x.
- (1, 3) and (5, 11): m = 8 ÷ 4 = 2, b = 3 − 2 = 1. Line: y = 2x + 1.
- (2, 5) and (6, 3): m = −2 ÷ 4 = −0.5, b = 5 + 1 = 6. Line: y = −0.5x + 6.
What the slope tells you
| Slope | Line |
|---|---|
| Positive | Goes up from left to right |
| Negative | Goes down from left to right |
| Zero | Horizontal (y = b) |
| Undefined | Vertical (both points share the same x) |
For a vertical line the formula would divide by zero, so the calculator reports "undefined" instead. The equation of a vertical line is x = constant.
Parallel and perpendicular lines
Parallel lines have the same slope. Perpendicular lines have slopes that multiply to −1: a line perpendicular to y = 2x + 1 has slope −0.5.
Real-world slopes
- Gradient as a percentage: slope × 100. A road that rises 5 m over 100 m has a 5% grade.
- Angle: θ = arctan(m). A slope of 1 is 45°.
- Rate of change: in a distance–time graph, the slope is the speed.
Related: Distance Between Two Points Calculator, Quadratic Equation Calculator.
Frequently Asked Questions
The slope of a line between two points, representing how steep the line is.
Rise over run — the change in y-coordinates divided by the change in x-coordinates between your two points.
The line goes downward from left to right, as opposed to a positive slope, which goes upward.
The slope is undefined — a vertical line — since the formula would require dividing by zero.
Slope (m) = (y₂ − y₁) / (x₂ − x₁) — the change in y divided by the change in x between two points on a line.
Slope is undefined when the two points share the same x-coordinate, which creates a vertical line — dividing by zero (x₂ − x₁ = 0) is mathematically undefined, which is why vertical lines don't have a numerical slope.