Loading calculator...
- Finds the slope m between two points (x₁, y₁) and (x₂, y₂).
- Gives the line equation y = mx + b, both intercepts and the angle.
- Also shows distance, midpoint, percent grade and the perpendicular slope.
- Handles horizontal (m = 0) and vertical (undefined) lines.
How to use the slope calculator
Enter point 1
Type x₁ and y₁, the coordinates of the first point.
Enter point 2
Type x₂ and y₂ for the second point.
Read the slope
The slope appears as a fraction where possible, with its decimal value and the line equation.
Use the extras
See the intercepts, angle, distance, midpoint and grade without extra work.
How slope is calculated
Slope formula
m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
If x₂ = x₁ the run is 0 and the slope is undefined (a vertical line).
Line equation and extras
b = y₁ − m × x₁, so y = mx + b
Distance = √((x₂ − x₁)² + (y₂ − y₁)²)
Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
Angle = arctan(m), Grade = m × 100%
Example 1: points (1, 2) and (4, 8)
A line rising from left to right.
- Rise and run 8 − 2 = 6, 4 − 1 = 3
- Slope 6 ÷ 3 = 2
- Equation y = 2x
- Distance 6.708204
- Midpoint (2.5, 5)
- Angle 63.4349°
A slope of 2 means y goes up 2 units for every 1 unit you move right.
Example 2: points (1, 5) and (3, 1)
A falling line.
- Slope (1 − 5) ÷ (3 − 1) = −2
- y-intercept 5 − (−2 × 1) = 7
- Equation y = −2x + 7
- x-intercept 3.5
A perpendicular line would have slope 0.5, the negative reciprocal of −2.
Example 3: a fractional slope
Points (0, 0) and (3, 2).
- Slope 2/3 (0.666667)
- Equation y = (2/3)x
- Angle 33.6901°
- Grade 66.67%
The calculator keeps the slope as an exact fraction when both rise and run are whole numbers.
Where a slope calculator helps
Algebra homework
Find slope, write y = mx + b and check graph questions with the working shown.
Ramps and roofs
Turn rise and run into an angle or percent grade for ramps, roofs and driveways.
Roads and trails
Express a hill’s steepness as a grade for cycling, hiking or road design.
Data trends
Find the rate of change between two data points, such as sales between two months.
The distance between the points uses the same idea as the Pythagorean theorem calculator. Simplify a fractional slope with the fraction calculator, or solve where a curve crosses the x-axis with the quadratic formula calculator.
Slope calculator FAQ
What is the slope of a line?
Slope measures steepness: how much y changes for each one-unit change in x. It is rise divided by run.
What does a negative slope mean?
The line goes down from left to right. As x increases, y decreases.
What is an undefined slope?
A vertical line has the same x for both points, so the run is 0. Dividing by 0 is undefined, so the line has no slope.
What is a zero slope?
A horizontal line has the same y for both points. The rise is 0, so the slope is 0 and the equation is y = constant.
How do I find the slope of a perpendicular line?
Take the negative reciprocal. If one line has slope 2, a perpendicular line has slope −1/2.
How do I turn slope into an angle or grade?
Angle = arctan(slope), and grade = slope × 100%. A slope of 1 is a 45° angle or a 100% grade.