School
Slope Calculator
The slope of the line through two points, as an exact fraction — with the equation of the line, its angle, its grade, the distance between the points and the midpoint.
Enter two points to find the slope of the line through them.
How this calculator works
Slope measures how steep a line is: how far it rises for each step it runs. Take the change in y between the two points (the rise) and divide it by the change in x (the run). A slope of 3/4 rises 3 for every 4 across.
The answer is kept as an exact fraction, because 2/3 is exact and 0.6667 is not. Each coordinate is read exactly as you typed it, so decimals such as 0.5 work too, and the equation of the line uses the same exact numbers.
From the slope come the rest. The y-intercept is where the line crosses the y-axis, which gives the equation in slope-intercept form, y = mx + b. The angle is the slope turned into degrees, and the grade is the slope as a percentage, the way roads and ramps are signed.
Two cases are special. A horizontal line has a slope of 0. A vertical line has no slope at all: its run is zero, and dividing by zero is undefined, so it is reported as undefined, with the equation x = a number.
The formula
Exactly what happens to your numbers, step by step.
Slope
m = (y₂ − y₁) ÷ (x₂ − x₁)Rise over run. The order of the points does not matter, as long as it is the same top and bottom.
Equation of the line
y = mx + b, where b = y₁ − m × x₁Angle and grade
angle = arctan(m) grade = m × 100%Distance and midpoint
d = √((x₂ − x₁)² + (y₂ − y₁)²) midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
A worked example
The line through the points (1, 2) and (5, 5).
What you enter
- Point 1
- (1, 2)
- Point 2
- (5, 5)
Step by step
- Rise
- 5 − 2 = 3
- Run
- 5 − 1 = 4
- Slope
- 3 ÷ 4 = 3/4
- Intercept
- b = 2 − 3/4 × 1 = 5/4
Slope 3/4; the line is y = (3/4)x + 5/4
The line rises 3 units for every 4 across: an angle of about 36.8699°, or a grade of 75%. The points are 5 units apart.
Slope questions, worked out
Rise over run, applied to the questions that come up most.
1.What is the slope of the line through (1, 2) and (5, 5)?
- Rise: y₂ − y₁ = 5 − 2 = 3
- Run: x₂ − x₁ = 5 − 1 = 4
- Slope: m = rise ÷ run = 3 ÷ 4 = 3/4
- Intercept: b = y₁ − m × x₁ = 2 − 3/4 × 1 = 5/4
- Equation: y = (3/4)x + 5/4
The slope is 3/4, and the line is y = (3/4)x + 5/4.
2.What is the slope of the line through (−2, 3) and (4, −1)?
- Rise: y₂ − y₁ = −1 − 3 = −4
- Run: x₂ − x₁ = 4 − (−2) = 6
- Slope: m = rise ÷ run = −4 ÷ 6 = −2/3
The slope is −2/3: negative, so the line falls from left to right.
3.What is the slope of the line through (3, 1) and (3, 7)?
- Rise: y₂ − y₁ = 7 − 1 = 6
- Run: x₂ − x₁ = 3 − 3 = 0
- The run is 0, so the line is vertical and its slope is undefined: division by zero.
Undefined. The line is vertical, x = 3.
4.A ramp rises 1 foot over a run of 12 feet. What is its slope as a grade and an angle?
- Slope = rise ÷ run = 1 ÷ 12 = 1/12.
- As a grade: 1 ÷ 12 × 100 = 8.3333%.
- As an angle: arctan(1 ÷ 12) = 4.7636°.
A slope of 1/12, which is a grade of 8.3333%, or an angle of 4.7636°.
Assumptions
Every result here rests on these. Change your inputs and the result changes with them.
- Points are on an ordinary x-y grid, with x across and y up.
- Angles are measured from the positive x-axis, in degrees.
- Grade is the slope as a percentage. A 100% grade is a 45° angle, not a vertical one.
What this cannot tell you
- It works on a straight line through two points. It does not fit a line to a scatter of points; that is linear regression.
- Very long decimals that cannot be read exactly are refused rather than rounded. Up to 15 digits is fine.
Questions people ask
What does a negative slope mean?
The line falls as it goes to the right. Through (−2, 3) and (4, −1) the rise is −4 and the run is 6, so the slope is −2/3: down 2 for every 3 across. A positive slope rises to the right.
What is an undefined slope?
The slope of a vertical line. Both points have the same x, so the run is zero, and rise divided by zero has no value. Its equation is x = a number, such as x = 3. A horizontal line is different: its slope is 0, and its equation is y = a number.
How do you find the equation of a line from two points?
Find the slope, m, as rise over run. Then put either point into y = mx + b to find b. Through (1, 2) and (5, 5), m is 3/4, and 2 = 3/4 × 1 + b gives b = 5/4, so the line is y = (3/4)x + 5/4.
What is the difference between slope and grade?
They are the same measure written differently. Grade is slope times 100, as a percentage: a ramp that rises 1 foot over 12 has a slope of 1/12, which is a grade of 8.3333%. A 100% grade rises as much as it runs, which is 45°.
Related calculators
- Pythagorean Theorem CalculatorThe missing side of a right triangle from the other two, with the exact square root, the angles and every step.School
- Proportion CalculatorSolve a/b = c/d for the missing value with cross-multiplication shown, or check whether two ratios are equal.School
- Triangle CalculatorSolve any triangle from three sides and angles: the missing sides, angles, area and perimeter.School
- Roofing CalculatorRoof area, squares and shingle bundles from footprint and pitch.Home
- Quadratic Formula CalculatorSolve ax² + bx + c = 0 with the discriminant and every substitution shown, and exact roots in simplest radical form.School
Sources and review
This calculator uses standard arithmetic with no external rules or published rates, so there is nothing to cite beyond the formulas shown above.
Methodology version 1.0.0 · Last reviewed
Cite this calculator
For coursework, a resource list or your own site. How every calculator is built and checked is set out on the methodology page.
Citation
Chalk Calculator. (2026, October 5). Slope Calculator (Methodology version 1.0.0). https://chalkcalculator.com/slope-calculator/Link to it from your site
<a href="https://chalkcalculator.com/slope-calculator/">Slope Calculator</a> from Chalk Calculator