Slope, Gradient & Line Equation Calculator
Calculate the slope (gradient), y-intercept, and full line equation from any two points. Includes parallel and perpendicular lines.
As an Amazon Associate and CJ Affiliate publisher we earn from qualifying purchases. Prices and availability may vary.
Gradient and Line Equations Guide
What should I know about 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).
What should I know about 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 ✓.
What's the key thing to understand about 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.
What's the key thing to understand about 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.
What's the difference between Point-Slope Form and Slope-Intercept Form?
Slope-intercept form, y = mx + c, is the most common way to write a line's equation, directly showing the slope m and the y-intercept c (where the line crosses the y-axis). Point-slope form, y − y₁ = m(x − x₁), is an alternative that's often more convenient when you know the slope and a single point on the line that isn't necessarily the y-intercept. Point-slope form is especially useful as an intermediate step: given a slope and one point, you can write the equation immediately without first solving for the y-intercept, then rearrange into slope-intercept form afterward by expanding and isolating y. For example, a line through (3, 5) with slope 2 is immediately y − 5 = 2(x − 3) in point-slope form; expanding gives y − 5 = 2x − 6, so y = 2x − 1 in slope-intercept form, revealing a y-intercept of −1. Both forms describe exactly the same line — the choice is purely about which is more convenient for the information you're starting with.
What should I know about Finding the X-Intercept?
The x-intercept is the point where a line crosses the x-axis — the point where y = 0. Given a line in slope-intercept form, y = mx + c, substituting y = 0 and solving for x gives x = −c/m, provided the slope m is not zero (a horizontal line, y = c, never crosses the x-axis unless c = 0, in which case it lies along the x-axis entirely). For example, the line y = 2x − 6 has an x-intercept at x = −(−6)/2 = 3, meaning the line passes through the point (3, 0). The x-intercept is particularly useful in applied contexts: if a line models a company's profit over time, the x-intercept marks the break-even point where profit crosses from negative to positive; if it models the height of a thrown object against time (in a linear approximation), the x-intercept marks when it returns to ground level. Alongside the y-intercept, the x-intercept is one of the two simplest reference points for sketching any linear graph by hand.
What should I know about Horizontal and Vertical Lines — The Special Cases?
A horizontal line has a slope of exactly zero, since y doesn't change as x changes, and its equation takes the simple form y = c (a constant), with no x term at all. A vertical line has an undefined slope, because the standard slope formula m = (y₂-y₁)/(x₂-x₁) would require dividing by zero (x never changes along a vertical line), and its equation is written as x = k instead — it cannot be expressed in y = mx + c form at all. These two cases are easy to mix up: "slope of zero" and "undefined slope" sound similar but describe opposite situations, and recognizing them quickly (a flat line has zero slope, a line going straight up has no defined slope) avoids a common error when classifying lines from a graph or from two given points that happen to share an x- or y-coordinate.
What should I know about Gradient-to-Angle Conversion?
| Gradient (m) | Angle of incline from horizontal |
|---|---|
| 0.1 | 5.7 degrees |
| 0.2 | 11.3 degrees |
| 0.5 | 26.6 degrees |
| 1 | 45 degrees |
| 2 | 63.4 degrees |
| 5 | 78.7 degrees |
What should I know about a Worked Example: The Perpendicular Line Through a Point?
As a worked example, find the line perpendicular to y=2x+3 through the point (4,1). The given line has gradient m1=2, so the perpendicular gradient satisfies m1×m2=−1, giving m2=−½. Using point-slope form: y−1=−½(x−4). Expanding: y−1=−½x+2, so y=−½x+3. Checking it passes through (4,1): y=−½(4)+3=1 ✓. Checking perpendicularity: 2×(−½)=−1 ✓. This two-step process — find the negative reciprocal, then use point-slope form — answers the large majority of 'find the perpendicular line through this point' questions.
What should I know about the General Form of a Linear Equation (Ax+By=C)?
Besides slope-intercept and point-slope form, a line can also be written in general form: Ax+By=C. This form is especially useful for vertical lines, which cannot be written in slope-intercept form at all but fit general form easily, such as x=5. Converting from slope-intercept to general form just requires rearranging: y=2x−1 becomes 2x−y=1. General form is also the natural form that emerges directly from real-world setups — a budget constraint '2 adult tickets at $12 plus child tickets at $8 must total exactly $64' is naturally written as 12a+8c=64 in general form.
What should I know about Finding Where Two Lines Intersect?
Two lines given in slope-intercept form intersect at the point where their y-values are equal, found by setting the two mx+c expressions equal to each other and solving for x. Worked example: find where y=2x−1 and y=−x+5 cross. Setting them equal: 2x−1=−x+5 → 3x=6 → x=2. Substituting back: y=2(2)−1=3. So the lines intersect at (2,3) — checking against the second equation confirms this: y=−(2)+5=3 ✓. This method works directly because both equations already isolate y, making substitution immediate without any rearranging first, which is exactly why slope-intercept form is often preferred over other line forms when checking whether, or where, two graphed lines will cross.
What should I know about Interpreting Gradient as a Rate of Change?
In any applied context, the gradient of a line represents a rate of change, and reading its units correctly is essential to interpreting it meaningfully. If a graph plots distance (metres) against time (seconds), the gradient's units are metres per second — speed. If a graph plots cost (pounds) against quantity (items), the gradient's units are pounds per item — the marginal cost of producing one more unit, with the y-intercept representing a fixed cost incurred even before any items are produced. If a graph plots temperature against time while a kettle heats, the gradient in degrees per minute is the heating rate. In every case, the gradient's units are always (units of y) per (units of x), and recognising this pattern immediately tells you what a line's slope physically represents in any new applied scenario. This is also why comparing the steepness of two differently-scaled graphs by eye can be misleading — only the numerical gradient, with its units made explicit, gives a fair comparison of two different rates of change.
What should I know about the Midpoint of a Line Segment?
Given two points that a line passes through, their midpoint — found by averaging the x-coordinates and averaging the y-coordinates separately, ((x1+x2)/2, (y1+y2)/2) — always lies exactly on the line connecting them, regardless of that line's gradient. For the points (2,3) and (6,11) used earlier (with equation y=2x−1), the midpoint is ((2+6)/2, (3+11)/2) = (4,7). Checking it lies on the line: y=2(4)−1=7 ✓, confirming the midpoint calculation is consistent with the line's own equation.