How to Find the Slope of a Line From Two Points
The slope formula explained step by step, what a positive, negative, zero or undefined slope actually means, and a worked example.
Published July 12, 2026
Slope describes how steeply a line rises or falls, and finding it from two known points is one of the most frequently needed calculations in algebra, geometry, and any field that deals with rates of change — from a road’s grade to a cost function’s marginal rate.
The slope formula
Given two points, (x₁, y₁) and (x₂, y₂), the slope is: (y₂ − y₁) / (x₂ − x₁) — the change in the vertical (y) direction divided by the change in the horizontal (x) direction. This ratio is often remembered as “rise over run,” where “rise” is how much the line moves up or down between the two points, and “run” is how much it moves left or right.
m = (y2 - y1) / (x2 - x1)
Rise (change in y) divided by run (change in x), using a consistent point order in both.
A worked example
Take the points (2, 3) and (6, 11). The change in y is 11 − 3 = 8; the change in x is 6 − 2 = 4. Slope = 8 ÷ 4 = 2. This means that for every 1 unit the line moves to the right, it rises 2 units — a fairly steep upward line.
Take a second example with a negative result: (1, 5) and (4, −1). Change in y is −1 − 5 = −6; change in x is 4 − 1 = 3. Slope = −6 ÷ 3 = −2 — the line falls 2 units for every 1 unit it moves right.
What the sign and size of the slope actually mean
A positive slope means the line rises as you move left to right — as x increases, y increases too. A negative slope means the line falls as you move left to right. The specific numeric value (not just its sign) describes steepness: a slope of 2 is steeper than a slope of 0.5, and a slope of −5 falls more steeply than a slope of −1, even though both are negative.
A slope of exactly zero describes a perfectly horizontal line — y doesn’t change at all as x changes, meaning the two points share the same y-value. An undefined slope occurs specifically when the two points share the same x-value, producing a vertical line — the formula’s denominator (the change in x) becomes zero, and division by zero is mathematically undefined, not simply “very large.” This is a genuinely different case from a zero slope, not just an extreme version of it, and it’s worth keeping the two straight: horizontal lines have zero slope; vertical lines have undefined slope.
A common mistake: subtracting the coordinates out of order
The slope formula requires subtracting the coordinates in a consistent order — if you calculate y₂ − y₁ in the numerator, you must calculate x₂ − x₁ (using the same point as “point 2”) in the denominator, not x₁ − x₂. Mixing the order flips the sign of the result, turning a genuinely positive slope into an incorrectly negative one, or vice versa. A reliable way to avoid this: pick which point is “point 1” and which is “point 2” before starting, and stay consistent for both the numerator and denominator.
Why slope matters beyond graphing lines
Slope isn’t just a graphing concept — it’s the mathematical foundation for describing any constant rate of change. A road’s grade (steepness) is a slope, expressed as a percentage. A cost function’s marginal cost — how much each additional unit costs to produce — is a slope, when cost is graphed against quantity. A speed, in its most basic form, is the slope of a distance-versus-time graph — this is exactly why “slope” and “rate of change” are effectively the same concept wearing different names depending on the context, and why understanding the two-point slope formula transfers directly to understanding rates of change generally, well beyond pure algebra coursework.
Calculating it directly
The Slope Calculator on this site takes two coordinate pairs and returns the slope directly, correctly handling the subtraction order and flagging the special zero and undefined cases automatically. If you need the actual distance between the two points rather than the steepness of the line connecting them, the Distance Calculator applies the related Pythagorean-theorem-based formula instead — a genuinely different question from slope, even though both start from the same two coordinate pairs.
Related calculators
Slope Calculator
Find the slope of a line between two points — the fundamental measure of steepness and direction in coordinate geometry.
Distance Between Two Points Calculator
Find the straight-line distance between two points on a plane — a direct application of the Pythagorean theorem to coordinate geometry.
Quadratic Equation Calculator
Solve ax² + bx + c = 0 for its real roots, instantly — using the quadratic formula, one of algebra's most foundational tools.