Slope Calculator
The slope between two points is the rise divided by the run: (y₂ − y₁) ÷ (x₂ − x₁). Enter both points to get that number along with the line in y = mx + b form, its y-intercept, its angle of inclination, the distance and midpoint between the points, and the same steepness expressed as a percentage grade and a rise:run ratio. Points sharing an x coordinate give a vertical line, whose slope is undefined rather than infinite, and that is reported as an answer here rather than an error.
- Accurate
- Real-time
- Easy to use
- 100% free
Slope
0.750000
Y-intercept b
2.000000
Details
Updates as you typeHorizontal coordinate of the first point. Negative values are fine.
Vertical coordinate of the first point.
Horizontal coordinate of the second point. Equal to x₁ makes the line vertical.
Vertical coordinate of the second point. Equal to y₁ makes the line horizontal.
Summary
Slope
0.750000
- Line equation
- y = 0.75x + 2
- Y-intercept b
- 2.000000
- Angle of inclination
- 36.8699 °
- Distance between the points
- 10.000000
- Midpoint
- (8, 8)
- Grade
- 75.00%
- Rise : run ratio
- 3 : 4
- The slope is the same whichever point you enter first: swapping them negates both the rise and the run, and the two minus signs cancel.
- Grade is the slope written as a percentage, so a slope of 0.08 is an 8% grade — the figure on a road sign. The rise:run ratio says the same thing the way a builder does, with 1:12 being the usual maximum for a wheelchair ramp.
- A slope of exactly 0 means a horizontal line, y = a constant. That is a real number and quite different from a vertical line, whose slope is undefined because its run is zero.
How this is calculated
- First point (x₁, y₁)
- (4, 5)
- Second point (x₂, y₂)
- (12, 11)
- Rise = y₂ − y₁
- 6.000000
- Run = x₂ − x₁
- 8.000000
- Slope m = rise ÷ run
- 0.750000
- b = y₁ − m × x₁
- 2.000000
- Equation y = mx + b
- y = 0.75x + 2
- Angle = atan(m)
- 36.8699 °
- Distance = √(rise² + run²)
- 10.000000
- Midpoint = ((x₁+x₂)/2, (y₁+y₂)/2)
- (8, 8)
- Grade = m × 100
- 75.00%
- Rise : run
- 3 : 4
Compare scenarios
See how one change moves the result
- CurrentYour inputs as they stand0.750000Current
- First point x₁50.857143
- First point y₁6.50.562500
- Second point x₂150.545455
Frequently asked questions
How do I calculate the slope between two points?
Subtract to get the rise and the run, then divide: m = (y₂ − y₁) ÷ (x₂ − x₁). From (4, 5) to (12, 11) the rise is 6 and the run is 8, so the slope is 6 ÷ 8 = 0.75. The order of the points does not matter, because swapping them flips the sign of both the rise and the run.
What is the slope of a vertical line?
It is undefined, not infinite and not an error. Both points share the same x coordinate, so the run is zero and rise ÷ run divides by zero, which has no value. A vertical line also cannot be written as y = mx + b; its equation is x = a constant, such as x = 4. Its angle of inclination is still exactly 90°, and the distance and midpoint are still ordinary numbers.
Is a horizontal line the same as a vertical one?
No, and confusing the two is the usual mistake. A horizontal line has a rise of zero and a non-zero run, so the division is perfectly ordinary and the slope is exactly 0. Its equation is y = a constant and its angle is 0°. Only the vertical case, where the run is zero, is undefined.
How do I turn a slope into a percentage grade or a ratio?
Multiply the slope by 100 for the grade, so a slope of 0.08 is an 8% grade — the number on a road sign. The ratio form writes the same steepness as rise:run in lowest terms, which is how ramps and roofs are specified: 1:12 is the usual maximum for a wheelchair ramp, and a roof described as 4:12 has a slope of 4 ÷ 12, about 0.333.
How is the angle of inclination worked out?
It is the arctangent of the slope, converted from radians to degrees: angle = atan(m). A slope of 1 gives exactly 45°, because rise and run are equal. Downhill lines have a negative slope and are reported here as a negative angle, so a slope of −1 is −45° rather than 135°.
What happens if I enter the same point twice?
You get an error, because two copies of one point do not pick out a line at all — infinitely many lines pass through a single point, and none of them is more correct than another. Move one of the coordinates and the calculator will answer.