Slope Calculator
Slope, y-intercept and the equation of the line through two points, plus distance, midpoint, angle and the perpendicular slope — with rise-over-run shown.
Slope Calculator: with the default inputs, slope (m) is 2.
Blank for a vertical line — the slope is undefined.
- Equation of the line
- y = 2x + 1
- y-intercept (b)
- 1
- Point-slope form
- y − 3 = 2(x − 1)
- Angle from the x-axis
- 63.4349 deg
- Grade
- 200%Slope × 100 — how roads and roofs quote steepness.
- Distance between the points
- 4.472136
- Midpoint
- (2, 5)
- Slope of a perpendicular line
- -0.5−1 ÷ m. Blank when the line is horizontal (the perpendicular is vertical).
Assumptions
- Coordinates are unitless; the angle is measured counter-clockwise from the positive x-axis.
- A vertical line returns a blank slope (undefined) rather than a number.
| Slope (rise ÷ run) | As a ratio | Grade | Angle (degrees) | |
|---|---|---|---|---|
| 0 | flat | 0% | 0 | |
| 0.02 | 1 up in 50 along | 2% | 1.15 | |
| 0.05 | 1 up in 20 along | 5% | 2.86 | |
| 0.0833 | 1 up in 12 along | 8.33% | 4.76 | |
| 0.1 | 1 up in 10 along | 10% | 5.71 | |
| 0.125 | 1 up in 8 along | 12.5% | 7.13 | |
| 0.1667 | 1 up in 6 along | 16.67% | 9.46 | |
| 0.25 | 1 up in 4 along | 25% | 14.04 | |
| 0.3333 | 1 up in 3 along | 33.33% | 18.43 | |
| 0.5 | 1 up in 2 along | 50% | 26.57 | |
| 0.75 | 1 up in 1.33 along | 75% | 36.87 | |
| 1 | 1 up in 1 along | 100% | 45 |
Your line has slope 2, a grade of 200% and an angle of 63.4349° from the horizontal. A negative slope is the same steepness downhill.
How this is worked out
The formula
m = (y₂ − y₁) ÷ (x₂ − x₁) (rise over run) b = y₁ − m·x₁, line: y = mx + b Point-slope form: y − y₁ = m(x − x₁) Angle θ = arctan(m); grade = m × 100% Distance = √((x₂ − x₁)² + (y₂ − y₁)²); midpoint = ((x₁ + x₂)/2, (y₁ + y₂)/2) Perpendicular slope = −1 ÷ m
Open How it’s calculated above to see this worked through with your own numbers.
What you enter
- x₁
- A number.defaults to 1
- y₁
- A number.defaults to 3
- x₂
- A number.defaults to 3
- y₂
- A number.defaults to 7
What you get back
- Slope (m)main answer
- Blank for a vertical line — the slope is undefined.
- Equation of the line
- y-intercept (b)
- Point-slope form
- Angle from the x-axis
- Grade
- Slope × 100 — how roads and roofs quote steepness.
- Distance between the points
- Midpoint
- Slope of a perpendicular line
- −1 ÷ m. Blank when the line is horizontal (the perpendicular is vertical).
What this assumes
- Coordinates are unitless; the angle is measured counter-clockwise from the positive x-axis.
- A vertical line returns a blank slope (undefined) rather than a number.
About this calculator
Slope is steepness as a number: how much a line rises for each unit it runs to the right. A slope of 2 climbs 2 for every 1 across; a slope of −½ drops 1 for every 2 across; a slope of 0 is flat. Two points are enough to fix a line, so two points are enough to find its slope, its equation and everything else about it.
How to use it
Enter the coordinates of any two points on the line. The order doesn't matter — swapping the points flips the sign of both rise and run, so the slope is unchanged. Along with the slope you get the y-intercept, the equation in slope-intercept and point-slope forms, the angle the line makes with the x-axis, the distance between the points and their midpoint.
Rise over run, and why it works
Similar triangles: any two points on a straight line make a right triangle with the same shape, so the ratio rise ÷ run is the same no matter which two points you choose. That constant ratio is the slope. Once you have m, plug either point into y = mx + b to solve for b.
Reading the results
- Positive slope rises left to right; negative falls; zero is horizontal.
- A vertical line has no slope — the run is zero and you'd divide by zero. The calculator reports it as undefined and gives the equation x = constant instead of inventing a number. "Undefined" and "zero" are not the same thing.
- Grade is slope × 100%: a 6% highway grade is a slope of 0.06. Angle is arctan(m); a 45° line has slope 1.
- Perpendicular slope is −1/m. Lines are perpendicular when their slopes multiply to −1, parallel when their slopes are equal.
Common mistakes
- Putting run over rise (Δx ÷ Δy).
- Subtracting in different orders on top and bottom: (y₂ − y₁) must go with (x₂ − x₁), not (x₁ − x₂).
- Calling a vertical line's slope "zero" or "infinite". It is undefined.
- Confusing the y-intercept b with the value of y at one of your points.
Frequently asked questions
▸How do I find the slope from two points?
Subtract the y-values and divide by the difference of the x-values, keeping the same order: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 3) and (3, 7): (7 − 3) ÷ (3 − 1) = 2.
▸What is the slope of a vertical line?
Undefined. The run is zero, so rise ÷ run would divide by zero. A horizontal line, by contrast, has slope exactly 0.
▸How do I write the equation of the line once I have the slope?
Use y = mx + b and solve for b with one point: b = y₁ − m·x₁. Or write point-slope form directly: y − y₁ = m(x − x₁).
▸How do I find the slope of a perpendicular line?
Take the negative reciprocal: −1 ÷ m. A line with slope 2 is perpendicular to any line with slope −½.
▸How do I turn slope into an angle or a percent grade?
Angle = arctan(slope); grade = slope × 100%. A slope of 1 is a 45° angle and a 100% grade.
Put this calculator on your own site
A working slope, free for any site, with no ads and no sign-up. It resizes to fit wherever you paste it and updates itself as this page improves.
Paste this anywhere. It works on any site, carries no ads, never expires, and always shows the current version.
Slope Calculator by CalculateItNow
The page's own title. The clearest description of what the link leads to.
The credit line sits outside the widget on purpose, so it is a real link on your page rather than one buried in a frame. Please keep it — it is what pays for CalculateItNow staying free and ad-free. The script only resizes the widget to fit its contents; drop it and the widget still works.
Browse every calculator widget·How to add it to WordPress, Squarespace or Wix
Related calculators
The questions people ask next to a slope.
Straight-line distance between two points in 2D or 3D from their coordinates, with Manhattan distance, midpoint and the Pythagorean working shown.
Least-squares slope, intercept, equation, r², standard error and a prediction for any x — from up to 10 data pairs, with the residual table shown.
Pearson's r, r-squared, covariance and the line of best fit for up to 10 (x, y) pairs, with the deviation table and a plain reading of how strong the link is.
Solve ax² + bx + c = 0 with the quadratic formula — real or complex roots, discriminant, vertex, axis of symmetry, factored form and a graph of the parabola.
Find the hypotenuse or a missing leg of a right triangle with a² + b² = c², plus its area, perimeter and angles — every step shown, any unit.
Simplify a ratio, solve a proportion (A:B = C:?) or split a total in a given ratio — with the GCD, cross-multiplication and each part shown.