Slope, Gradient & Line Equation Calculator
Calculate the slope (gradient), y-intercept, and full line equation from any two points. Includes parallel and perpendicular lines.
Gradient and Line Equations Guide
The Gradient Formula
Gradient (m) = (y₂ − y₁) / (x₂ − x₁) = rise / run. The gradient tells you how steep the line is: a gradient of 2 means the line rises 2 units for every 1 unit across. Positive gradient: line slopes upward left to right. Negative gradient: slopes downward. Zero gradient: horizontal line. Undefined gradient (x₁ = x₂): vertical line. Gradients are used in every area of mathematics, physics (rate of change), and geography (hill steepness as a percentage).
y = mx + c Form
The slope-intercept form y = mx + c is the most useful way to write a line equation. m is the gradient (how steep), c is the y-intercept (where the line crosses the y-axis). From two points: find m first, then substitute one point to find c: c = y₁ − m×x₁. Example: points (2,3) and (6,11): m = (11−3)/(6−2) = 8/4 = 2. c = 3 − 2×2 = -1. Equation: y = 2x − 1. Check with point 2: y = 2(6)−1 = 11 ✓.
Parallel and Perpendicular Lines
Parallel lines have equal gradients. A line parallel to y = 3x + 2 has gradient 3. Perpendicular lines have gradients that are negative reciprocals: if m = 3, perpendicular gradient = −1/3. Product of perpendicular gradients always = −1: m₁ × m₂ = −1. This is why roads that cross at right angles have related gradients, and why the slope of a function and its inverse are reciprocals of each other.
Real-World Gradients
Road gradient 5% means 5m rise per 100m horizontal distance. UK motorway maximum gradient: 3% (1 in 33). Steep mountain road: 10–25%. Roof pitch expressed as gradient: a 45° roof has gradient 1 (1:1 rise:run). Accessible ramp gradient: maximum 1:12 (8.3%) per BS 8300. Ski slope difficulty: green 8–12%, blue 12–25%, red 25–40%, black 40%+. Train maximum gradient (UK mainline): typically 1:100 (1%) for high-speed; heritage railways 1:50 (2%) maximum.
Recommended for this calculator