CalculateItNow home

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.

Try an example
Slope (m)
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%
Distance between the points
4.472136
Midpoint
(2, 5)
Slope of a perpendicular line
-0.5
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, grade and angle side by side
Slope (rise ÷ run)As a ratioGradeAngle (degrees)
0flat0%0
0.021 up in 50 along2%1.15
0.051 up in 20 along5%2.86
0.08331 up in 12 along8.33%4.76
0.11 up in 10 along10%5.71
0.1251 up in 8 along12.5%7.13
0.16671 up in 6 along16.67%9.46
0.251 up in 4 along25%14.04
0.33331 up in 3 along33.33%18.43
0.51 up in 2 along50%26.57
0.751 up in 1.33 along75%36.87
11 up in 1 along100%45
112 of 15

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.

Math verified by automated testsUpdated 2026-09-082 sources cited

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

The questions people ask next to a slope.

All math calculators·Browse everything