Slope Calculator
Find the slope, angle and line equation through two points.
About Slope Calculator
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₁)²)
Worked example
With the default values below, Slope Calculator returns Slope (m) of 2. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Point 1 — x₁
- 1
- Point 1 — y₁
- 2
- Point 2 — x₂
- 4
- Point 2 — y₂
- 8
Results
- 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
- 1Rise (Δy)= 6
- 2Run (Δx)= 3
- 3Slope (m = rise/run)= m = 2
- 4y-intercept= b = 0
- 5Line equation (slope-intercept form)= y = 2x
- 6Distance= 6.70820393 units
- 7Angle with x-axis= 63.4349° (1.107149 rad)
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
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.
