Slope calculator
Everything about the straight line through two points.
Slope (m)
Slope (m): 0.75
- Slope as a fraction
- 3/4
- Equation
- y = 0.75x + 1.25
- Angle
- ≈ 36.8699 °
- Gradient
- 75%
- Distance
- 5
- Midpoint
- (3, 3.5)
- y-intercept (b)
- 1.25
Step by step
- m = (5 − 2) ÷ (5 − 1) = 3 ÷ 4 = 3/4
- b = 2 − 0.75 × 1 = 1.25
How it works
The slope is the rise (change in y) divided by the run (change in x). A positive slope goes up from left to right; a negative one goes down.
The y-intercept b is where the line crosses the y-axis, found by putting one point into y = mx + b. The angle is the arctangent of the slope, and the gradient percentage is the slope times 100, as on road signs.
Calculations are exact, so slopes like 1/3 stay fractions.
Formula
m = (y₂ − y₁) ÷ (x₂ − x₁) b = y₁ − m × x₁ angle = arctan(m) d = √((x₂ − x₁)² + (y₂ − y₁)²)
Worked example
From (1, 2) to (5, 5): m = 3 ÷ 4 = 0.75, b = 2 − 0.75 × 1 = 1.25, so y = 0.75x + 1.25. The angle is about 36.87°, the distance 5 and the midpoint (3, 3.5).
Questions people ask
What is the slope of a horizontal line?
Zero: y does not change as x changes. Its equation is simply y = b.
Why is a vertical line’s slope undefined?
The run is zero, and division by zero is undefined. Its equation is x = a constant.
How is a 10% road gradient related to slope?
A 10% gradient is a slope of 0.1: 10 m of climb for every 100 m measured horizontally, an angle of about 5.71°.