How to find the slope between two points
From two points you can find the slope of the line through them, the distance between them, their midpoint and the equation of the line. This guide gives the formulas with one worked example and the special cases.
The short version
- Find the changes. Δx = x₂ − x₁ and Δy = y₂ − y₁.
- Slope: m = Δy ÷ Δx (rise over run).
- Distance: √(Δx² + Δy²).
- Line equation: y = mx + b, where b = y₁ − m·x₁.
Skip the arithmetic. The free Slope Calculator does this for you, shows the formula and the working with your own numbers, and runs in your browser - nothing you type is uploaded. Also useful: System of Equations Solver, Quadratic Formula Calculator.
A worked example: (1, 2) and (4, 6)
What the slope tells you
Slope is rise over run: how much y changes for each 1 step in x. A slope of 4/3 climbs 4 units for every 3 to the right. Positive slopes rise from left to right, negative slopes fall, zero is a flat line and an undefined slope is a vertical line.
Horizontal and vertical lines
- Horizontal (same y): Δy = 0, so the slope is 0 and the line is y = a number.
- Vertical (same x): Δx = 0, so the slope formula would divide by zero. The slope is undefined and the line is x = a number.
Parallel and perpendicular lines
Parallel lines have equal slopes. Perpendicular lines have slopes whose product is −1: the negative reciprocal. A line with slope 4/3 has perpendiculars with slope −3/4.
A second example: a negative slope and a vertical line
Points (−2, 5) and (4, −1):
Points (3, 1) and (3, 7) have the same x, so Δx = 0: the slope is undefined, the distance is 6 and the line is x = 3. Mind the double negative when you subtract a negative coordinate.
Mistakes to avoid
- Subtracting in a different order on top and bottom. Use (y₂ − y₁) ÷ (x₂ − x₁) or reverse both, never one of each.
- Forgetting that distance uses the squares, so it is never negative.
- Calling a vertical line's slope 0 instead of undefined.