Slope Calculator
Enter two points and get the slope of the line that joins them, plus the y-intercept and the full equation y = mx + b.
Two points, the whole line
Give the calculator (x₁, y₁) and (x₂, y₂) and it returns the slope (rise ÷ run) and the y-intercept — everything needed for y = mx + b.
Vertical lines have no slope
If the two x-values are the same, the run is zero and the slope is undefined. The calculator reports no result rather than a misleading number.
What is a slope calculator?
Rise over run, made instant
A slope calculator measures how steeply a straight line climbs or falls between two points. The slope — also called the gradient — is the change in height (the rise) divided by the change in horizontal distance (the run): slope = (y2 − y1) ÷ (x2 − x1). Once you know the slope, the calculator also finds the y-intercept b, the point where the line crosses the y-axis, so you get the complete line equation y = mx + b. That single equation describes ramps and roof pitches, the rate of change on a graph, the price-versus-quantity line in economics, and any homework problem that asks for the equation of a line through two points.
Enter two points and get the slope, the y-intercept, and the equation y = mx + b instantly.
Two short formulas, both built from the coordinates of your two points.
slope = (y2 − y1) ÷ (x2 − x1)The slope is the rise (the change in y) divided by the run (the change in x). Subtract the coordinates in the same order on the top and the bottom — second point minus first point — so the signs stay consistent. The y-intercept then comes from b = y1 − m × x1: rearranged from y = mx + b, it tells you where the line meets the y-axis. Together the slope m and the intercept b give the whole equation of the line.
Suppose your two points are (1, 2) and (3, 6).
Rise and run
Rise = 6 − 2 = 4. Run = 3 − 1 = 2. The line goes up 4 for every 2 across.
Slope
slope = 4 ÷ 2 = 2 — the line climbs 2 units of y for each unit of x.
Y-intercept
b = y1 − m × x1 = 2 − 2 × 1 = 0, so the line passes through the origin: y = 2x.
The slope tells you both the direction and the steepness of the line. A positive slope (like the 2 in our example) means the line rises from left to right — y grows as x grows. A negative slope means it falls from left to right, and a slope of zero is a perfectly flat, horizontal line where y never changes. The size of the number is the steepness: a slope of 2 climbs twice as fast as a slope of 1, while a slope of 0.5 is a gentle incline. The y-intercept b tells you where the line starts on the y-axis when x is zero — in our example b = 0, so the line goes through the origin. One special case has no number at all: when the two x-values are equal the run is zero, the line is perfectly vertical, and the slope is undefined because you cannot divide by zero. In the real world, a slope is a grade: a 5 % wheelchair ramp, a roof pitch, or the rate of change of one quantity against another on a graph.
The formulas are exact, but a couple of practical points are worth keeping in mind.
Distinct x-values and consistent order
The two points must have different x-values; if x₂ equals x₁ the line is vertical and the slope is undefined, so the calculator returns no result. Always subtract the coordinates in the same order — second point minus first on both the top and the bottom — or the sign of the slope will flip. The result describes a single straight line, not a curve: for curved data the slope only gives the average rate of change between the two points you chose.