Slope Calculator
Find slope, angle, distance and line equation through two points; handles vertical lines (undefined slope).
Inputs
Slope (m)
2
Line equation
y = 2x
y-intercept (b)
0.000000
Distance between points
6.708204
Angle with x-axis
63.4349°
Rise (Δy)
6.0000
Run (Δx)
3.0000
Step by step
Rise (Δy)
y₂ − y₁ = 8 − 2
= 6
Run (Δx)
x₂ − x₁ = 4 − 1
= 3
Slope (m = rise/run)
6 ÷ 3
= m = 2
y-intercept
b = y₁ − m·x₁ = 2 − 2 × 1
= b = 0
Line equation (slope-intercept form)
= y = 2x
Distance
√((3)² + (6)²) = √(9 + 36)
= 6.70820393 units
Angle with x-axis
arctan(2)
= 63.4349° (1.107149 rad)
How it works
Slope is rise over run: how many units y changes for every one unit increase in x. Given two points (x₁, y₁) and (x₂, y₂), slope m = (y₂−y₁)/(x₂−x₁). A positive slope rises left to right; negative falls. A zero slope is horizontal; an undefined slope is a vertical line. The slope-intercept form y = mx + b describes the full line where b is the y-value when x = 0.
Formulas
Slope
m = (y₂ − y₁) / (x₂ − x₁)
- m
- Slope
- Δy
- Rise (y₂ − y₁)
- Δx
- Run (x₂ − x₁)
Slope-intercept form
y = mx + b where b = y₁ − m·x₁
Distance
distance = √((x₂−x₁)² + (y₂−y₁)²)
Frequently Asked Questions
What does 'undefined slope' mean?
A slope of undefined means the line is perfectly vertical: x₁ = x₂. Run (Δx) = 0, and dividing by zero is undefined. The equation of such a line is x = constant.
What is the y-intercept?
The y-intercept b is the value of y where the line crosses the y-axis (i.e., when x = 0). It is calculated as b = y₁ − m·x₁.
How do I find the slope of a line from its equation?
Rearrange to y = mx + b form. The coefficient of x is the slope m. For example, 2x − y + 3 = 0 rearranges to y = 2x + 3, so the slope is 2.