Slope Calculator
Enter two points. You get the slope, the line through them in slope-intercept form, the distance and the midpoint.
Need the full working for a harder problem? Try the systems of equations step-by-step solver.
The formula
m = (y₂ − y₁) ÷ (x₂ − x₁). The line is y = mx + b, with b = y₁ − m·x₁.
Worked example
Revenue was 12,000 in month 3 and 18,000 in month 7. What is the trend?
- Rise: 18,000 − 12,000 = 6,000
- Run: 7 − 3 = 4 months
- Slope: 6,000 ÷ 4 = 1,500 per month
- Intercept: 12,000 − 1,500 × 3 = 7,500
Revenue grows by 1,500 a month along the line y = 1,500x + 7,500.
How it works
Slope
Rise over run: m = (y₂ − y₁) / (x₂ − x₁).
Line equation
Substitute one point into y = mx + b and solve for b.
Distance
Use the Pythagorean theorem on the differences: √((x₂ − x₁)² + (y₂ − y₁)²).
Midpoint
Average the x values and average the y values.
Good to know
- The order of the points does not matter, as long as you subtract in the same order top and bottom.
- A vertical line has an undefined slope and the equation x = constant. A horizontal line has slope 0.
- Slope is a rate: its units are the y units per x unit.
Common questions
What is the slope of a vertical line?
It is undefined, because the run is zero. The line's equation is x = a constant.
What does a negative slope mean?
The line falls from left to right: y decreases as x increases.
How do slopes of parallel and perpendicular lines compare?
Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line with slope 2 is perpendicular to one with slope −1/2.
How do I turn a slope into a percent grade or an angle?
Multiply by 100 for a percent grade: a slope of 0.08 is an 8% grade. For the angle, take the inverse tangent: atan(0.08) is about 4.6°.
What does the y-intercept mean in practice?
It is the value of y when x is 0. In the revenue example it is the level the trend line implies at month zero.