Slope Calculator
Calculate the slope of a line between two points using (y₂ − y₁) / (x₂ − x₁). Measures steepness and direction — the rise over the run.
Last updated: May 2026
Compare with similar
About this calculator
The slope of a line measures how steeply it rises or falls and in which direction, defined as the change in y divided by the change in x between two points. The formula is m = (y₂ − y₁) / (x₂ − x₁), often described as 'rise over run', where the rise is the vertical change and the run is the horizontal change between two points (x₁, y₁) and (x₂, y₂). A positive slope means the line goes up from left to right; a negative slope means it goes down; a slope of zero is a horizontal line; and an undefined slope (division by zero, when x₁ = x₂) is a vertical line. The magnitude of the slope tells you steepness: a slope of 2 rises twice as fast as a slope of 1. Slope is the foundation of linear equations (y = mx + b, where m is the slope and b is the y-intercept), and in calculus it generalizes to the derivative, which is the instantaneous slope of a curve. It appears everywhere: the grade of a road, the pitch of a roof, the rate of change in a graph, and the cost per unit in economics. Edge cases: if the two x-values are equal, the run is zero and the slope is undefined, signaling a vertical line; if the two y-values are equal, the slope is zero, a horizontal line. The order of the points does not matter as long as you are consistent — subtract the coordinates in the same order in both the numerator and denominator.
How to use
Example 1 — points (1, 2) and (4, 8). Enter x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 8. Slope = (8 − 2) / (4 − 1) = 6 / 3 = 2. Verify: the line rises 6 units vertically for every 3 units horizontally, a positive slope of 2, meaning a fairly steep upward line. Example 2 — points (0, 0) and (5, 10). Enter x₁ = 0, y₁ = 0, x₂ = 5, y₂ = 10. Slope = (10 − 0) / (5 − 0) = 10 / 5 = 2. Verify: this line also has a slope of 2, the same steepness as the first example, confirming that different point pairs can lie on parallel lines.
Frequently asked questions
What does a negative or zero slope mean?
A negative slope means the line falls as you move from left to right — y decreases as x increases — like a downhill grade. A slope of zero means the line is perfectly horizontal: y never changes regardless of x. A positive slope rises from left to right. The sign of the slope therefore tells you the direction of the line at a glance, while its magnitude tells you how steep it is. A common interpretation in real terms is rate of change: a negative slope might represent a declining temperature over time, while a zero slope represents no change at all.
Why is the slope of a vertical line undefined?
A vertical line has the same x-coordinate at every point, so when you compute the run (x₂ − x₁) you get zero, and division by zero is undefined in mathematics. This is why vertical lines are said to have an undefined (not infinite) slope. Practically, it means a vertical line rises infinitely for no horizontal movement, which the slope concept cannot express as a number. If your calculation produces a zero denominator, your points lie on a vertical line. Horizontal lines, by contrast, have a defined slope of exactly zero, so do not confuse the two cases.
Does the order of the two points matter?
No, as long as you are consistent — you must subtract the coordinates in the same order in both the numerator and the denominator. If you start with point 2's y-value on top, you must also start with point 2's x-value on the bottom. Reversing both gives the same result because the two negative signs cancel: (y₂ − y₁)/(x₂ − x₁) equals (y₁ − y₂)/(x₁ − x₂). The mistake to avoid is mixing the order, such as putting y₂ − y₁ over x₁ − x₂, which flips the sign and gives the wrong slope. Pick an order and apply it to both differences.
How is slope used in the equation of a line?
Slope is the m in the slope-intercept form of a line, y = mx + b, where b is the y-intercept (the point where the line crosses the y-axis). Once you know the slope from two points, you can find b by plugging one point's coordinates into the equation and solving. This lets you write the full equation of the line and predict the y-value for any x. Slope also appears in point-slope form, y − y₁ = m(x − x₁), which is convenient when you know one point and the slope. Understanding slope is therefore the gateway to working with linear equations and graphs.
When should I NOT use this calculator?
It computes the slope of a straight line between two points, so it is not appropriate for curves, where the slope changes continuously and you need calculus (the derivative) to find the slope at a specific point. It also returns an undefined or error result for a vertical line, since the slope does not exist as a number there. Make sure your two points are genuinely distinct; identical points give 0/0, which is meaningless. And remember that slope alone does not define a line — you also need a point or the intercept for the full equation. For average rate of change over a curve, the two-point slope gives only the average, not the instantaneous, rate.