Slope, Gradient & Angle Calculator
Find the slope between two points, convert between gradient formats, and get the line equation. Used in maths, construction, civil engineering, and navigation.
Slope Formula
Slope, sometimes called gradient, measures how steeply a line rises or falls. The formula is m = (y₂ − y₁) ÷ (x₂ − x₁) — the change in y (the 'rise') divided by the change in x (the 'run'). The result is a single number that captures the line's steepness and direction. A positive slope means the line goes up from left to right; negative means it goes down; zero means it's horizontal (no rise at all); and an undefined slope (division by zero, when x₂ = x₁) means the line is vertical. A worked example: a line through (1, 3) and (4, 9) has slope (9 − 3) ÷ (4 − 1) = 6/3 = 2, meaning the line rises 2 units for every 1 unit it moves right. The order of the points doesn't matter as long as you're consistent — taking (4, 9) first and (1, 3) second gives (3 − 9) ÷ (1 − 4) = −6/−3 = 2, the same answer. The most common error is mismatched ordering, taking the y-difference one way and the x-difference the other, which flips the sign incorrectly. Slope is the fundamental concept underlying linear functions, calculus (where it generalises to the derivative — the slope of a tangent line), and many real-world rates of change, from speed (slope of distance vs time) to interest growth.
Gradient Formats
Slope can be expressed in three equivalent ways, and different fields use different conventions, so it's useful to convert between them. As a decimal or fraction: the raw slope number, like 0.05 or 1/20. As a ratio: the same slope written as '1 in 20' (one unit of rise per 20 units of run), often used in UK road and rail signage. As a percentage: multiply the decimal by 100, so 0.05 becomes 5% — common for road grades, ramps, and accessibility standards. As an angle: take the arctangent (inverse tan) of the slope to get the angle from horizontal, so a 5% grade is arctan(0.05) ≈ 2.86°. Connecting these: a 5% road grade equals 1 in 20 ratio equals 2.86° angle. Reference values give a feel: an accessible wheelchair ramp is typically a maximum of 1:12 (about 5° or 8.3%), a typical staircase rises at about 35-40°, the steepest residential roads usually max out around 15-20%, and the world's steepest road (Baldwin Street in New Zealand) has a 35% gradient. UK road signs traditionally used ratios (1:5, 1:7) but have largely moved to percentages, which match European norms. For accessibility design and engineering, percentage or ratio is standard; for physics and maths, the raw slope or angle is more common.
Line Equation
Once you know the slope of a line, you can write its full equation in the form y = mx + b, where m is the slope and b is the y-intercept — the value of y when x = 0, which is where the line crosses the y-axis. Given the slope and any point (x₁, y₁) on the line, you can find b by rearranging: b = y₁ − m × x₁. Two points always fully define a unique straight line, so given two points this calculator finds the slope, then the y-intercept, then writes out the full equation. A worked example: a line through (2, 5) with slope 3 has b = 5 − 3 × 2 = −1, so its equation is y = 3x − 1. You can check by substituting: when x = 2, y = 6 − 1 = 5 ✓. The y = mx + b form is called the slope-intercept form and is the most useful for plotting and understanding behaviour. An equivalent form, the point-slope form y − y₁ = m(x − x₁), is handy when you have a point and a slope but don't immediately want to compute b. Once you have the equation, you can find any other point on the line by substituting an x-value, find where it crosses the x-axis (set y = 0 and solve for x), or find where it intersects another line (solve the two equations simultaneously). This calculator returns the full equation along with the slope, so you have a complete description of the line.
Exam Tips and Common Errors
A few habits prevent the most common slope mistakes. First, watch the signs carefully when subtracting — (y₂ − y₁) and (x₂ − x₁) must use the same ordering, and a misplaced minus sign flips the slope's sign and changes the answer entirely. Second, division by zero (when x₁ = x₂) means a vertical line, which has an undefined slope, not infinity or zero — flag this case rather than computing nonsense. Third, the formula gives you slope, not the line — you need a point as well to write the full equation; just a slope tells you the steepness but not where the line sits. Fourth, watch unit consistency: if x is in metres and y in kilometres, the slope's units are km/m, which can be confusing — better to convert to the same units first. Fifth, in physics problems, slope often has a physical meaning (the slope of a distance-time graph is velocity; the slope of velocity-time is acceleration), so the units of the slope are the units of the y-axis divided by the units of the x-axis. Sixth, in coordinate geometry exam questions, the slope formula is the gateway to many further results — perpendicular lines have slopes that multiply to −1, parallel lines have equal slopes — so getting the slope right matters for what follows. Finally, sanity-check by visualising: a positive slope goes up to the right; if your line obviously should go down (your y-values decrease as x increases) but you got a positive slope, recheck your arithmetic. This calculator handles the algebra; understanding what slope represents catches most errors.
Recommended for this calculator