Slope Calculator
Calculate the slope between two points (x₁,y₁) and (x₂,y₂).
Did this tool answer your question?
Thanks — this helps us improve the tool.
How to use this tool
- Enter x₁, y₁, x₂ and y₂ in the fields above.
- Results update instantly as you type — or click Calculate.
- Read your slope (m) and the full breakdown beneath it.
Calculate the slope (gradient) of a line passing through two points using m = (y₂−y₁)/(x₂−x₁).
Formula
m = (y₂ − y₁) / (x₂ − x₁)
Also written as rise / run, where rise = y₂ − y₁ and run = x₂ − x₁.
How it works
The calculator subtracts the y-coordinates (rise) and divides by the difference in x-coordinates (run) to find the slope of the straight line connecting two points. If both x-values are equal the run is zero and the result is ±Infinity (a vertical line has undefined slope).
Worked example
Worked example: slope through (1, 2) and (4, 8)
- Inputs: x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 8.
- Rise = y₂ − y₁ = 8 − 2 = 6.
- Run = x₂ − x₁ = 4 − 1 = 3.
- Slope m = 6 / 3 = 2.
Slope m = 2
Common mistakes to avoid
- Reversing the order of subtraction: computing (x2-x1)/(y2-y1) instead of (y2-y1)/(x2-x1).
- Dividing by zero when x1 = x2; a vertical line has undefined slope, not zero slope.
- Confusing zero slope (horizontal line, y1=y2) with undefined slope (vertical line, x1=x2).
Key terms
- Slope (m)
- A measure of the steepness of a line; the ratio of vertical change to horizontal change between any two points.
- Rise
- The vertical change between two points on a line: y₂ − y₁.
- Run
- The horizontal change between two points on a line: x₂ − x₁.
- Gradient
- Another term for slope, commonly used in the UK and in calculus contexts.
- Undefined slope
- The slope of a vertical line, where the run is zero and division by zero occurs.
Frequently asked questions
- How do you calculate slope from two points?
- The slope formula is m = (y₂ − y₁) / (x₂ − x₁). A positive slope means the line goes up from left to right.