Slope Calculator
Enter any two points and get the slope as both a fraction and a decimal, the full line equation y = mx + b, the distance between the points, and the midpoint — with the rise-over-run substitution shown step by step, exactly the way you would write it on a homework page.
Point 1 = (x₁, y₁), Point 2 = (x₂, y₂). Decimals and negative numbers are fine.
Slope (m)
2
Line equation
y = 2x
Distance
8.9443
Midpoint
(3, 6)
Step-by-step solution
- m = (y₂ − y₁) / (x₂ − x₁)
- m = (10 − 2) / (5 − 1) = 8 / 4 (rise / run)
- m = 2
- b = y₁ − m·x₁ = 2 − 2 · 1 = 0
- Equation: y = 2x
- Distance = √(rise² + run²) = √(8² + 4²) = √80 = 8.9443
- Midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2) = (3, 6)
The slope formula, worked out
The slope measures how steep a line is: m = (y₂ − y₁) / (x₂ − x₁), or rise over run. Take the points (1, 2) and (5, 10). The rise is 10 − 2 = 8 and the run is 5 − 1 = 4, so m = 8/4 = 2. To finish the equation, plug either point into b = y₁ − m·x₁ = 2 − 2 · 1 = 0, giving y = 2x.
The same two points also give you the distance — the rise and run are the two legs of a right triangle, so the distance is the hypotenuse from the Pythagorean theorem: √(8² + 4²) = √80 ≈ 8.944. The midpoint simply averages the coordinates: (3, 6).
One special case: if both points share the same x-coordinate, the run is zero and the slope is undefined — the line is vertical and its equation is x = c. The calculator detects this automatically instead of dividing by zero.
More math calculators
Working through an algebra course? The quadratic formula calculator solves ax² + bx + c = 0 with the discriminant shown, and the z-score calculator handles the statistics side. For arithmetic practice there is a long division calculator with the classic bring-down steps, a decimal to fraction converter, and a percent change calculator.