Calculate slope, y-intercept, and line equation between any two coordinate points.
Reviewed by the CalculatorKosh Editorial TeamUpdated June 2026Free ยท No sign-up
Slope Calculator
Calculate slope, y-intercept, and line equation between any two coordinate points.
How It Works
This slope calculator finds how steep a straight line is when it passes through two points, (xโ, yโ) and (xโ, yโ). Steepness is measured as the ratio of vertical change (the rise) to horizontal change (the run) โ in short, "rise over run". Alongside the slope itself, the tool also returns the y-intercept, the full line equation in slope-intercept form, the straight-line distance between the two points, and the angle the line makes with the x-axis. It is built for students working through coordinate geometry or algebra homework, as well as anyone needing a quick gradient for a ramp, a road, a roof, a staircase, or a drainage pipe.
What the slope tells you
A positive slope rises from left to right; a negative slope falls from left to right. A slope of zero is a flat, horizontal line, while a vertical line has an undefined slope because the run is zero and you cannot divide by zero. The larger the absolute value of the slope, the steeper the line: a slope of 5 climbs five times faster than a slope of 1. This single number is the foundation of linear functions, rates of change, and the idea of a derivative in calculus. In the real world the same concept describes the grade of a road, the pitch of a roof, the rake of a wheelchair ramp, and the fall on a drainage pipe โ anywhere one quantity changes steadily against another, the slope captures exactly how fast.
Slope, gradient, and angle
These three describe the same steepness in different units. The raw slope is a plain ratio. Multiply it by 100 and you get the gradient as a percentage, which is how road signs warn drivers of a steep hill โ a 1-in-10 descent is a 10% gradient and a slope of 0.1. Take the arctangent of the slope and you get the angle in degrees, which is how a carpenter or surveyor might describe the same incline. This calculator gives you the slope and the angle directly, and the percentage is a quick mental step away.
Formulas used
Slope (m): m = (yโ โ yโ) / (xโ โ xโ)
Y-Intercept (b): b = yโ โ mยทxโ
Line Equation: y = mx + b (slope-intercept form)
Distance: d = โ((xโโxโ)ยฒ + (yโโyโ)ยฒ)
Angle with X-axis: ฮธ = arctan(m) ร (180/ฯ)
A worked example
Take the two points (2, 3) and (6, 11). The rise is yโ โ yโ = 11 โ 3 = 8, and the run is xโ โ xโ = 6 โ 2 = 4. Dividing rise by run gives a slope of 8 รท 4 = 2, so the line climbs two units up for every one unit across. To find the y-intercept, substitute one point into b = yโ โ mยทxโ: b = 3 โ (2 ร 2) = โ1. The full equation is therefore y = 2x โ 1. The distance between the points is โ(4ยฒ + 8ยฒ) = โ(16 + 64) = โ80, which is about 8.94 units. Finally, the angle with the x-axis is arctan(2), roughly 63.4ยฐ โ a fairly steep incline.
Tips
You can pick the two points in either order; as long as you subtract the y-values and the x-values in the same order, the slope comes out identical. To express a slope as a percentage gradient โ the way road and ramp signs usually do โ multiply it by 100, so a slope of 0.08 is an 8% grade. If you only have the angle of an incline, you can reverse the process: the slope equals the tangent of that angle. For accessibility ramps, many building codes recommend a gentle gradient (often around 1:12, or roughly 8.3%), which is worth checking against local rules.
Common mistakes
The most common error is flipping rise and run โ dividing the horizontal change by the vertical change instead of the other way round. Another is being inconsistent with subtraction order, for example computing yโ โ yโ on top but xโ โ xโ on the bottom, which wrongly reverses the sign. Be careful with negative coordinates, since subtracting a negative becomes addition. And remember that when xโ equals xโ the line is vertical and has no defined slope at all โ this calculator flags that case rather than returning a misleading number.
Frequently Asked Questions
Slope describes how much y changes for every 1 unit increase in x. A slope of 3 means y increases by 3 each time x increases by 1. It is calculated as rise over run: (yโ โ yโ) / (xโ โ xโ).
Part of Geometry Calculators โ compare every related calculator in one place.