Math
Slope calculator
Rise over run, and everything that falls out of it — the equation of the line, its angle, and how far apart the points are.
Rise over run
Slope measures how steeply a line climbs: the change in y divided by the change in x.
m = (y₂ − y₁) / (x₂ − x₁)
From (2, 3) to (8, 15) the rise is 12 and the run is 6, so m = 2. The line goes up 2 units for every 1 across. The order of the points does not matter as long as you are consistent — subtracting both the other way flips both signs and leaves the quotient unchanged.
Reading the sign and size
- Positive — the line rises left to right.
- Negative — it falls.
- Zero — horizontal. All y values equal, so the rise is zero.
- Undefined — vertical. The run is zero, and division by zero has no value. This is why "no slope" and "zero slope" mean opposite things, a distinction that costs marks in exams constantly.
From slope to the equation of the line
Once you have m, substitute either point into y = mx + b and solve for b. With m = 2 and the point (2, 3): 3 = 2(2) + b, so b = −1, and the line is y = 2x − 1.
Point-slope form is often quicker if you are only asked for an equation: y − y₁ = m(x − x₁) can be written down immediately with no algebra at all.
Parallel and perpendicular
Parallel lines share a slope. Perpendicular lines have slopes whose product is −1, so the perpendicular to a line of slope 2 has slope −½. The calculator shows this because it is the most commonly needed follow-up question.
The exception is the horizontal-vertical pair: a horizontal line has slope 0 and its perpendicular is vertical with undefined slope, so the product rule cannot be applied there.
Slope in the real world
Road gradients are usually quoted as percentages, which is simply slope × 100 — an 8% hill rises 8 metres per 100 horizontal. Roof pitch is often given as rise per 12 units of run, so a "6 in 12" roof has slope 0.5. Wheelchair ramp standards commonly cap gradient at 1:12, or about 8.3%.
The angle of inclination, also shown, is arctan(m). A slope of 1 is exactly 45°. Note that gradient percentage and angle are not the same thing and diverge quickly — a 100% gradient is 45°, not vertical.
Common questions
What is the slope formula?
m = (y2 - y1) / (x2 - x1), the change in y divided by the change in x. It does not matter which point you call first, provided you subtract both coordinates in the same order.
What is the difference between zero slope and undefined slope?
A horizontal line has zero slope — the rise is zero. A vertical line has undefined slope because the run is zero and you cannot divide by it. They are opposites, not synonyms.
How do I find the perpendicular slope?
Take the negative reciprocal. If the slope is 2, the perpendicular is -1/2, because the product of perpendicular slopes is -1. The rule breaks only for horizontal and vertical pairs.
Is slope the same as angle?
No. Slope is a ratio, angle is a rotation, and they relate through angle = arctan(slope). A slope of 1 is 45 degrees, and a 100% gradient is also 45 degrees — not vertical, as people often assume.