Slope Calculator
Slope = (y₂ − y₁) / (x₂ − x₁). For (1, 2) and (4, 8): (8 − 2) / (4 − 1) = 6 / 3 = 2, y-intercept 0, so the equation is y = 2x.
How to use
- Enter the coordinates of the first point (x₁, y₁) and the second point (x₂, y₂).
- Read the slope, the y-intercept, the equation in y = mx + b form and the extras below it.
- If both points have the same x, the line is vertical and the slope is undefined. The equation is then x = a constant.
How it works
Slope m = (y₂ − y₁) ÷ (x₂ − x₁), the rise over the run.
The y-intercept is b = y₁ − m × x₁, and the line is y = mx + b.
Distance between the points = √((x₂ − x₁)² + (y₂ − y₁)²). The midpoint is the average of the x values and of the y values.
The angle is arctan(m), measured from the positive x-axis, between −90° and 90°. A positive slope rises to the right and a negative slope falls.
Percent grade = m × 100%, the rise per 100 units of run. A slope of 0.05 is a 5% grade.
FAQ
What does a slope of 0 mean?
A horizontal line. The y value does not change, so the equation is y = a constant.
Why is the slope of a vertical line undefined?
Because the run is 0 and you cannot divide by 0. A vertical line is written x = a constant.
Does the order of the two points matter?
No. Swapping them flips the sign of both rise and run, so the slope is the same.
How do I find the y-intercept from two points?
First find the slope m. Then put one point into b = y − m × x. For (1, 2) and (4, 8), m = 2 and b = 2 − 2 × 1 = 0, so the line is y = 2x.
How do I turn a slope into an angle or a percent grade?
Angle = arctan(m) and grade = m × 100%. A slope of 1 is 45° and a 100% grade; a slope of 0.05 is about 2.86° and a 5% grade. The tool shows both.
How do I find the slope as a fraction?
The tool shows the rise over run reduced to lowest terms, such as 2/3, when it can.