How steep is the line through two points?
A straight line is completely described by how steep it is and where it sits. The steepness is its slope: the ratio of vertical change to horizontal change between any two points on it. Slope is the number behind a road's steepness, a ramp's accessibility, a roof's pitch and the rate in any \u201cper unit\u201d relationship — dollars per hour, metres per second — because all of those are one quantity changing against another. This page takes the two points and returns not just the slope but everything packed into the same pair of points: the distance between them (the Pythagorean theorem applied to the rise and the run), the point exactly halfway, and the full equation of the line, so any other point on it can be found.
The formulas, with every term defined
Slope m = (y\u2082 \u2212 y\u2081) \u00f7 (x\u2082 \u2212 x\u2081)Distance = \u221a((x\u2082 \u2212 x\u2081)\u00b2 + (y\u2082 \u2212 y\u2081)\u00b2) \u00b7 Midpoint = ((x\u2081 + x\u2082) \u00f7 2, (y\u2081 + y\u2082) \u00f7 2) \u00b7 Line: y = mx + b, with b = y\u2081 \u2212 m \u00d7 x\u2081
Read it in words. The numerator of the slope, y\u2082 \u2212 y\u2081, is the rise — how far up (or down) the line travels between the points. The denominator, x\u2082 \u2212 x\u2081, is the run — how far across. Slope is rise over run, a rate: a slope of 1.5 means the line climbs one and a half units for every single unit across, whatever the units are. The sign carries the direction: positive slopes climb left to right, negative slopes fall, a slope of exactly zero is a flat horizontal line, and a run of zero makes the ratio a division by zero — a vertical line, whose slope is undefined, not infinite. The distance formula treats the rise and run as the two legs of a right triangle whose hypotenuse joins the points, and the midpoint simply averages the two x values and the two y values — the halfway point of a journey between the points in both directions at once. Finally, once m is known, the intercept b falls out by substituting either point into y = mx + b, and the equation can then produce the y for any x on the line.
Worked example: the points (1, 2) and (5, 8)
The defaults above enter the points (1, 2) and (5, 8). The run is 5 \u2212 1 = 4 and the rise is 8 \u2212 2 = 6, so the slope is 6 \u00f7 4 = 1.5 — as a simplified fraction, 3/2, the same rate stated in whole numbers. The distance between the points is \u221a(4\u00b2 + 6\u00b2) = \u221a(16 + 36) = \u221a52 = 7.2111. The midpoint is ((1 + 5) \u00f7 2, (2 + 8) \u00f7 2) = (3, 5) — and it must lie on the line, which the equation confirms below. The intercept is b = 2 \u2212 1.5 \u00d7 1 = 0.5, so the line's equation is y = 1.5x + 0.5. Two checks close it: at x = 5 the equation gives 1.5 \u00d7 5 + 0.5 = 8, the second point exactly; and at the midpoint's x = 3 it gives 1.5 \u00d7 3 + 0.5 = 5, the midpoint's y. The line makes an angle of 56.3099\u00b0 with the horizontal and, expressed as a road-style grade, a slope of 1.5 is a 150% grade — far steeper than any real road, which is exactly what a rise of 6 over a run of 4 should feel like, as the chart near the top draws the rise, the run and the distance.
One pair of points, every kind of line
| Points | Slope | Distance | Midpoint | Intercept | Angle |
|---|---|---|---|---|---|
| (1, 2) to (5, 8) — worked example | 1.5 | 7.2111 | (3, 5) | 0.5 | 56.3099\u00b0 |
| (0, 0) to (4, 3) | 0.75 | 5 | (2, 1.5) | 0 | 36.8699\u00b0 |
| (2, 3) to (6, 3) — flat | 0 | 4 | (4, 3) | 3 | 0\u00b0 |
| (0, 5) to (5, 0) — falling | \u22121 | 7.0711 | (2.5, 2.5) | 5 | \u221245\u00b0 |
| (\u22122, \u22123) to (4, 9) | 2 | 13.4164 | (1, 3) | 1 | 63.4349\u00b0 |
| (1, 1) to (1, 7) — vertical | Undefined | 6 | (1, 4) | \u2014 | 90\u00b0 |
Read the table by slope. The flat row has a rise of zero, so the slope is zero whatever the run — a horizontal line, y = 3, whose \u201cintercept\u201d is the line itself. The falling row drops exactly as fast as it advances, slope \u22121, at \u221245\u00b0: equal and opposite changes, which is why \u22121 and +1 are the two diagonal slopes. The (0, 0) to (4, 3) row is the classic 3-4-5 triangle in disguise — rise 3, run 4, distance exactly 5 — the same triple the Pythagorean calculator is built around. And the vertical row is the one case with no slope at all: its run is zero, the ratio cannot be formed, and its equation is not y = anything but x = 1 — every point on it shares the same x. Slope's close cousin in the triangle calculator is the angle work there: a slope and an angle are two statements of the same steepness, joined by the tangent, which is why this page reports both.
Reading a slope honestly — the limits
Four cautions belong with any result here. Order does not matter, consistency does: swapping the two points negates both the rise and the run, leaving the ratio unchanged — (−6) \u00f7 (−4) is the same 1.5 — but mixing the order inside one difference (y\u2082 \u2212 y\u2081 over x\u2081 \u2212 x\u2082) flips the sign and invents a falling line from a climbing one, the most common slope error there is. A slope has no units of its own, but it joins two: on graph paper the units cancel visually, yet in a real problem the slope is metres per metre, dollars per hour or degrees per kilometre — quoting the bare number without its \u201cper\u201d hides what the rate means. Steepness grows without limit while angles do not: doubling a slope from 1 to 2 moves the angle only from 45\u00b0 to 63.4349\u00b0, and a slope of 10 sits at about 84\u00b0 — the angle scale compresses exactly where the slope scale explodes towards the vertical, which is why road engineers quote the percent grade (slope \u00d7 100) and surveyors quote the angle, each where their scale behaves. And two points define the line between them, not beyond them: extending y = mx + b far outside the entered points is extrapolation — the equation will happily comply, but whether the real relationship stays straight out there is a question about the situation, not the arithmetic.
Frequently asked questions
What is slope, in plain words?
How much a line climbs for each step across — the rise divided by the run between two of its points. A slope of 1.5, the worked example's answer, means the line goes up 1.5 units for every 1 unit it goes across (6 up over 4 across, which simplifies to 3 over 2). A big slope is a steep line, a slope near zero is nearly flat, and a negative slope falls as it goes.
What is the difference between a slope of zero and an undefined slope?
They are opposite extremes, often confused. A slope of zero is a flat horizontal line: the rise is 0, and 0 divided by any run is 0 — the line (2, 3) to (6, 3) has slope 0 and the equation y = 3. An undefined slope is a vertical line: the run is 0, and division by zero has no answer at all — the line (1, 1) to (1, 7) has no slope and the equation x = 1. Zero is a number; undefined is the absence of one.
Does it matter which point I call first?
No, as long as each subtraction uses the same order top and bottom. (8 \u2212 2) \u00f7 (5 \u2212 1) = 6 \u00f7 4 = 1.5, and reversing both gives (2 \u2212 8) \u00f7 (1 \u2212 5) = (\u22126) \u00f7 (\u22124) = 1.5 as well — the two minus signs cancel. The error to avoid is reversing only one subtraction, which flips the sign and reports a climbing line as a falling one.
How are slope, angle and percent grade related?
They are three dialects of the same steepness. The angle is the arctangent of the slope: a slope of 1 is 45\u00b0, the worked example's 1.5 is 56.3099\u00b0. The percent grade is the slope times 100: 1.5 becomes a 150% grade, while a gentle road grade of 6% is a slope of only 0.06, an angle of about 3.4\u00b0. This page reports all three so each audience — student, driver, builder — gets the dialect it uses.
How do I check the line equation is right?
Substitute both points into it — the equation must reproduce each point's y from its x. For y = 1.5x + 0.5: at x = 1 it gives 2, the first point, and at x = 5 it gives 8, the second. The midpoint is a third free check, since it must lie on the line: at x = 3 the equation gives 5, exactly the midpoint (3, 5). If any substitution misses, the intercept was worked out from a different slope than the one printed — recompute b from the same m.
