PERSONAL FINANCE · 206 TOOLS · 0 SIGN-UP
TallyBench / Slope Calculator
// SLOPE CALCULATOR

Two points in, the whole line out.

Slope, angle, intercept, equation and distance — everything determined by a pair of coordinates.

Slope (m)—
Angle from horizontal—
y-intercept (b)—
Line equation—
Distance between points—

The same number, three ways

This page's default — (1, 2) to (4, 11) — gives a slope of exactly 3. Read as a ratio, that is "3 units up for every 1 across." Read as an angle, arctan(3) = 71.565° from horizontal. Read as a road or roof grade, multiply by 100: a 300% grade — absurdly steep for a road (most highway grades stay under 8%) but an ordinary roof pitch.

Where a slope this steep shows up in practice

Roofers describe pitch as a rise over a fixed 12-unit run rather than as a decimal slope — a "9-in-12" roof has a slope of 9/12 = 0.75. Accessibility ramps go the other way: the ADA's general standard caps a ramp at a 1-in-12 rise-to-run ratio, a slope of about 0.083, roughly 4.76° — anything steeper and it stops qualifying as a compliant ramp. The same rise-over-run arithmetic this page performs on two coordinates sits behind both figures; see the Triangle Calculator if a roof's angle and rafter length are known directly instead of two coordinate points.

The distance figure, and where it comes from

Alongside the slope, this page also reports the straight-line distance between the two points — for the default, √(3² + 9²) = √90 ≈ 9.487. That is the same Pythagorean distance formula used by the Coordinate Distance Calculator, and the angle this page reports from horizontal is the same angle a Right Triangle would show at the corner where a horizontal run meets a vertical rise of that slope.

Rise over run

Slope is the change in y divided by the change in x: m = (y₂ − y₁) / (x₂ − x₁). From (1, 2) to (4, 11) the rise is 9 and the run is 3, so the slope is 3 — the line climbs three units for every one it moves right.

Once you have m, the intercept follows from either point: b = y − mx. Here that is 2 − 3(1) = −1, giving y = 3x − 1.

Vertical lines have no slope — not zero slope

A horizontal line has slope zero: it rises not at all. A vertical line has undefined slope, because the run is zero and you cannot divide by it. The two get confused constantly, and the distinction matters: a vertical line cannot be written as y = mx + b at all, only as x = constant.

Slope as an angle, and as a percentage

The angle from horizontal is arctan(m). A slope of 1 is 45°, a slope of 3 is 71.57°. Road gradients are usually quoted as percentages instead, where the percentage is the slope times 100 — a 10% gradient means a slope of 0.1, rising 1 metre over 10.

Parallel lines share a slope. Perpendicular lines have slopes whose product is −1, so the perpendicular to a slope of 3 has slope −⅓.

What does a negative slope mean?

The line falls from left to right — y decreases as x increases. The steepness is given by the absolute value, so a slope of −3 is exactly as steep as +3, just descending.

Why is the slope of a vertical line undefined rather than infinite?

Because the run is zero and division by zero has no value. Saying "infinite" is a loose description of the limit as a line approaches vertical, not a definition. A vertical line simply cannot be expressed in y = mx + b form.

How do I find the slope perpendicular to a line?

Take the negative reciprocal. A slope of 3 gives a perpendicular of −1/3, and their product is −1. Horizontal and vertical are the exception, since one has slope 0 and the other is undefined.

Is a 10% gradient the same as a 10° slope?

No, and confusing them understates steep hills. A 10% gradient is a slope of 0.1, which is about 5.71°. They only converge for very shallow angles.

For the straight-line distance alone, including in three dimensions, use the Coordinate Distance Calculator — the underlying step is the Pythagorean theorem. For solving the resulting equations, see the Quadratic Formula Calculator and the Scientific Calculator. Roof pitch and stair rise are the same idea applied to building: see the Roofing Calculator and the Stair Calculator.