Slope Calculator
Enter the coordinates of two points to get the slope of the line between them and its equation.
Result
- Line equation
- y = 3x − 1
- Angle of inclination
- 71.5651°
- Grade
- 300%
- Distance between the points
- 6.324555
- Midpoint
- (2, 5)
How to use the slope calculator
Enter the x and y coordinates of two different points. The calculator returns the slope, the line equation in slope-intercept form, the angle of inclination, the percent grade, the straight-line distance and the midpoint. Negative and decimal coordinates are fine.
Formulas
Slope m = (y₂ − y₁) ÷ (x₂ − x₁), which is rise over run.
The intercept is b = y₁ − m × x₁, which gives y = mx + b. The angle is arctan(m) and the grade is m × 100. Distance is √((x₂ − x₁)² + (y₂ − y₁)²).
Worked example
For (1, 2) and (3, 8): m = (8 − 2) ÷ (3 − 1) = 3. The intercept is 2 − 3 × 1 = −1, so the line is y = 3x − 1. The angle is 71.57° and the distance is √40 = 6.32.
Limits
- Vertical lines (x₁ = x₂) have an undefined slope and are reported as an error.
- Results are rounded to six decimal places for display.
- Slope is unit-free only when x and y use the same unit. For a road grade, enter height and distance in the same unit, such as metres.
- Angles are given in degrees, between −90 and 90.
Frequently asked questions
What does a negative slope mean?
The line falls from left to right. As x increases, y decreases. A positive slope rises, a zero slope is horizontal.
Why is the slope of a vertical line undefined?
A vertical line has no run, so the formula divides by zero. Such a line is written x = c instead of y = mx + b.
How do I turn slope into a percent grade or an angle?
Grade is the slope times 100. The angle is the arctangent of the slope. A slope of 1 is a 100% grade and a 45 degree angle.
Sources and methodology
Last reviewed 2026-12-04