The slope of a line through two points is m = (y2 − y1) / (x2 − x1): subtract the y-coordinates to get the rise, subtract the x-coordinates in the same order to get the run, then divide. For the points (2, 3) and (6, 11), that is (11 − 3) / (6 − 2) = 8 / 4 = 2 — the line climbs 2 units for every 1 unit it moves across. This guide covers the formula in depth, all four types of slope, how slope becomes the equation of a line, and the parallel and perpendicular rules, with worked examples throughout.
The Slope Formula, Step by Step
Slope measures steepness and direction in a single number. The numerator, y2 − y1, is the vertical change (the rise); the denominator, x2 − x1, is the horizontal change (the run). The one rule that cannot be broken: subtract in the same order in both halves. If y comes from the second point first, x must come from the second point first too. The reversed version, (y1 − y2) / (x1 − x2), gives the same answer because both differences flip sign — but mixing the orders, such as (y2 − y1) / (x1 − x2), flips the sign of the result, and it is the most common slope error in homework and in real surveying notes alike.
Before the examples, one upgrade in thinking: slope is always a rate, and in real data it carries units. If y is dollars and x is hours, the slope is dollars per hour; if y is feet and x is seconds, the slope is feet per second — a speed. The two-point formula does not change, but the units of the answer are (units of y) ÷ (units of x), and stating them is part of a complete answer. Example: a tank holds 240 gallons at 9 a.m. and 90 gallons at noon. Slope = (90 − 240) / (3 − 0) = −150 / 3 = −50 gallons per hour — a drain rate, negative because the amount is falling.
Worked example with negative numbers: find the slope through (−1, 4) and (3, −2). Rise: y2 − y1 = −2 − 4 = −6. Run: x2 − x1 = 3 − (−1) = 4. Slope: m = −6 / 4 = −1.5. The negative sign is information, not a mistake: it says the line falls as x increases, dropping 1.5 units for every unit across. Plotting the two points confirms it — the second point sits lower and to the right of the first. When both differences come out negative, the slope is positive: (−6) / (−4) = 1.5, a rising line. If you want the arithmetic checked while you practice, the slope calculator shows the slope as a decimal, a percent and an angle for any pair of points.
The Four Types of Slope
Positive slope means the line rises from left to right. Example: through (0, 0) and (4, 8), m = (8 − 0) / (4 − 0) = 2. Most real-world growth — savings over time, or distance over time at constant speed — has a positive slope. Negative slope means the line falls from left to right: through (0, 10) and (5, 0), m = (0 − 10) / (5 − 0) = −10 / 5 = −2. Picture a draining tank or a depreciating car: as x (time) grows, y (the amount) shrinks.
Zero slope belongs to horizontal lines, where y never changes: through (1, 5) and (7, 5), m = (5 − 5) / (7 − 1) = 0 / 6 = 0. Zero divided by anything except zero is zero, so the slope exists and equals 0. Undefined slope belongs to vertical lines, where x never changes: through (3, 1) and (3, 9), m = (9 − 1) / (3 − 3) = 8 / 0, and division by zero is undefined in mathematics — not zero, and not a usable number at all. A vertical line is the one case where the formula cannot return an answer, and undefined is the correct thing to write.
From Slope to the Equation of a Line: y = mx + b
Slope becomes much more useful once it sits inside the slope-intercept equation, y = mx + b, where m is the slope and b is the y-intercept — the height at which the line crosses the y-axis. Given a slope and any one point on the line, you can solve for b. Example: a line has slope 2 and passes through (2, 3). Substitute: 3 = 2 × 2 + b, so 3 = 4 + b, and b = −1. The full equation is y = 2x − 1. Check it against the point you started from: 2 × 2 − 1 = 3, which matches.
Worked example from two points, start to finish: find the equation of the line through (1, 5) and (4, 14). Step 1, slope: m = (14 − 5) / (4 − 1) = 9 / 3 = 3. Step 2, intercept, using the first point: 5 = 3 × 1 + b, so b = 2. Step 3, write the equation: y = 3x + 2. Step 4, verify with the second point: 3 × 4 + 2 = 14, which matches. This four-step routine — slope, substitute, solve, verify — handles every two-point problem, including the ones with fractions and negative coordinates.
Parallel and Perpendicular Lines
Parallel lines have exactly equal slopes: they climb at the same rate, so they never meet. The lines y = 2x + 1 and y = 2x − 5 are parallel — same m = 2, different intercepts. Perpendicular lines meet at a right angle, and their slopes are negative reciprocals of each other: flip the fraction and change the sign. If one line has slope 2, a perpendicular line has slope −1/2; if one has slope −3/4, the perpendicular slope is 4/3. The quick test: multiply the two slopes — perpendicular lines always give −1 (2 × −1/2 = −1, and −3/4 × 4/3 = −1). The exception is the axis-aligned pair: a horizontal line (slope 0) is perpendicular to a vertical line (undefined slope), which the reciprocal rule cannot express but the geometry makes obvious.
More Worked Examples
Example A — a vertical line in disguise: find the slope through (5, 7) and (5, −3). Rise: −3 − 7 = −10. Run: 5 − 5 = 0. The slope is −10 / 0, which is undefined. Whenever the two x-coordinates match, stop: the line is vertical and there is no slope to report. Example B — matching coordinates: through (−2, −4) and (4, 2), the rise is 2 − (−4) = 6 and the run is 4 − (−2) = 6, so m = 6 / 6 = 1. A slope of exactly 1 is a perfect 45° climb, with equal rise and run.
Example C — decimals: find the slope through (0.5, 1.5) and (2.5, 5.5). Rise: 5.5 − 1.5 = 4. Run: 2.5 − 0.5 = 2. Slope: m = 4 / 2 = 2. Decimals subtract exactly like whole numbers here; the method does not change. Example D — a gentle real-world rate: a road climbs 30 ft over 600 ft of horizontal distance, so m = 30 / 600 = 0.05. That tiny decimal is why engineers switch formats: expressed as a grade it is 0.05 × 100 = 5%, and as an angle it is arctan(0.05) ≈ 2.86° — the same slope wearing three different outfits.
Two more places slope hides. On a graph, you can read slope without any coordinates: pick two lattice points the line passes through cleanly, count the vertical change (rise) and the horizontal change (run) between them, and divide — the counts are the coordinate differences done visually. In an equation written in standard form, such as 2x + 3y = 6, rearrange to slope-intercept form: 3y = −2x + 6, so y = (−2/3)x + 2, and the slope is −2/3. Any linear equation, however it is dressed, has its slope sitting in front of x once y is alone on one side.
Slope Outside the Classroom
The same rise-over-run ratio runs ramps, roofs and roads. An accessibility ramp built at 1:12 has slope 1/12 ≈ 0.0833, or 8.33% — the subject of our ADA ramp slope guide. A 6:12 roof pitch is a slope of 0.5. Road signs report grade in percent, which is just slope × 100. And when the question is about the angle rather than the ratio — how steeply a ramp or a sightline tilts — the angle is arctan(slope), which is what the angle of elevation calculator works out from a height and a distance. If two points are all you have, the slope calculator returns the decimal, percent, ratio and angle forms together.
Common Mistakes When Calculating Slope
Five errors recur constantly. First, inverting the formula — dividing run by rise — which turns a slope of 2 into 0.5. Second, subtracting in mismatched orders, which flips the sign. Third, confusing the two zero cases: 0/6 = 0 (a horizontal line, whose slope exists), while 8/0 is undefined (a vertical line) — the position of the zero is everything. Fourth, sign slips with negative coordinates: 3 − (−1) is 4, not 2. Fifth, assuming slope must be a whole number or a neat fraction; real data produces decimals like 0.0833 or −1.37, and those are complete, correct answers. Sketching the two points takes ten seconds and catches most of these errors before they cost anything.
Slope is one idea — rise divided by run — with a long reach: it classifies lines, builds their equations through y = mx + b, decides parallel and perpendicular relationships, and reappears in the real world as ramp ratios, roof pitches and road grades. Keep the subtraction order consistent, respect the vertical-line exception, and verify two-point equations by substituting the second point back in. For quick checks while you work, the slope calculator handles two-point and rise-and-run inputs and shows every common format at once.
