Slope Calculator

Enter two points to get the slope, the equation of the line in three forms, both intercepts, the angle and percent grade, and the distance and midpoint between the points.

Runs in your browser; nothing you type is sent anywhere. · Updated

How to use the slope calculator

Enter the coordinates of two points, (x₁, y₁) and (x₂, y₂). The slope is shown as a reduced fraction when both differences are whole numbers, along with the decimal, the line's equation, intercepts, angle, grade and the perpendicular slope.

The slope formula

m = (y₂ − y₁) ÷ (x₂ − x₁), or rise over run.

For (1, 2) and (4, 8): m = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2. The line rises 2 units for every 1 unit to the right.

Slope Line Example points
Positive Rises left to right (0, 0) and (2, 4): m = 2
Negative Falls left to right (0, 5) and (5, 0): m = −1
Zero Horizontal (1, 3) and (6, 3): m = 0
Undefined Vertical (2, 1) and (2, 7): run is 0

Writing the equation of the line

Form General For (1, 2) and (4, 8)
Slope-intercept y = mx + b y = 2x
Point-slope y − y₁ = m(x − x₁) y − 2 = 2(x − 1)
Standard Ax + By = C 2x − y = 0

Find b (the y-intercept) by plugging one point into y = mx + b: 2 = 2(1) + b, so b = 0.

Slope as an angle or percent grade

  • Angle = arctan(slope). A slope of 1 is 45°.
  • Percent grade = slope × 100. Roads, ramps and drainage use grades: a 1 : 12 wheelchair ramp is 8.33%, and a 2% grade drops 2 ft per 100 ft.
  • Roof pitch is rise per 12 in of run: a 6/12 roof has a slope of 0.5 (26.6°). See the roofing calculator for roof area.
Slope Angle Grade
0.02 1.1° 2%
0.0833 (1 : 12) 4.8° 8.33%
0.25 14.0° 25%
0.5 26.6° 50%
1 45° 100%
2 63.4° 200%

Parallel and perpendicular lines

Parallel lines have the same slope. Perpendicular lines have slopes that multiply to −1: the perpendicular to a slope of 2 is −½.

Frequently asked questions

How do you find the slope between two points?

Subtract the y-values and divide by the difference in x-values, in the same order: (y₂ − y₁) ÷ (x₂ − x₁).

What is the slope of a horizontal line?

Zero. The y-value doesn't change, so the rise is 0.

Why is a vertical line's slope undefined?

The run (x₂ − x₁) is zero, and you can't divide by zero.

How do I convert slope to degrees?

Take the arctangent of the slope. A slope of 0.5 is arctan(0.5) = 26.57°.