How to use the slope calculator
- Two points: enter (x₁, y₁) and (x₂, y₂). You get the slope, the equation of the line in three forms, the distance between the points, the midpoint, the angle and the grade.
- Point and slope: enter one point and the slope (as a number or a fraction such as −3/4) to get the equation of the line.
When you enter whole numbers or decimals, answers are given as exact fractions, with decimals alongside.
Slope formula
m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
y = mx + b, where b = y₁ − m × x₁
Distance = √((x₂ − x₁)² + (y₂ − y₁)²)
Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
Worked example
Points (1, 2) and (4, 8): rise = 8 − 2 = 6 and run = 4 − 1 = 3, so the slope is m = 2.
b = 2 − 2 × 1 = 0, so the equation is y = 2x (standard form 2x − y = 0). The distance is √(3² + 6²) = √45 = 3√5 ≈ 6.708204, the midpoint is (2.5, 5) and the angle is 63.4349°.
What the slope tells you
- Positive: the line rises from left to right.
- Negative: it falls from left to right.
- Zero: it's horizontal (y = b).
- Undefined: it's vertical (x = a number), because the run is 0.
Grade is the slope as a percentage, used for roads, ramps and roofs: a 1 in 12 ramp has a grade of 8.33%. For quadratic curves, use the quadratic formula calculator.
Frequently asked questions
What's the slope of a vertical line?
It's undefined, because you'd divide by zero. The equation is x = (the x value of both points).
How do I find the angle from the slope?
Angle = arctan(m). A slope of 1 is 45°; a slope of 2 is about 63.43°.
Formulas checked 29 October 2026. How we test our calculators. Check important results, and show your own working where your teacher or exam asks for it.