πŸ“ Slope Calculator

The slope between two points, plus everything that comes with it: the angle, the distance, the midpoint and the equation of the line in both standard forms.

Slope, gradient and angle β€” three names for the same steepness

Slope is rise over run: how far a line climbs for every unit it travels sideways. The same steepness gets reported three different ways depending on who is asking. A mathematician says the slope is 0.5, a road engineer says the gradient is 50%, and a surveyor says the angle is 26.57 degrees. All three describe one line.

m = (y₂ − y₁) / (x₂ − x₁) = rise / run

The same steepness in every notation
Slope (m)GradientAngleExample
0.022%1.15Β°Wheelchair ramp limit
0.088%4.57Β°Steep motorway grade
0.550%26.57Β°Low-pitched roof
1100%45Β°A 45-degree slope
2200%63.43Β°Very steep stair
undefinedβ€”90Β°A vertical line

Notice that a 100% gradient is 45 degrees, not vertical. This catches people out constantly, because percentage feels like it should max out at 100. It does not: gradient is a ratio, and a ratio has no upper limit.

Converting between the three

Gradient % = m × 100  ·  Angle = arctan(m)  ·  m = tan(angle)

Going from slope to gradient is a multiplication; going to an angle needs the arctangent. The common error is to assume the relationship between gradient and angle is linear β€” it is not, and it diverges badly above about 20%. A 10% gradient is 5.71 degrees and a 20% gradient is 11.31, not 11.42.

The slope-intercept form, and what the intercepts mean

y = mx + c

Once you have the slope, one point fixes the whole line: substitute to find c, the value of y where the line crosses the vertical axis. The x-intercept comes from setting y to zero, giving x = −c/m. Through (2, 3) and (8, 15), the slope is 2, c is −1, and the line is y = 2x − 1, crossing the x-axis at 0.5.

Two special cases break the formula. A horizontal line has a slope of zero, which is fine. A vertical line has a run of zero, so the slope is undefined rather than infinite, and the line cannot be written as y = mx + c at all β€” it is written x = k. Any calculator that reports a vertical line's slope as a huge number is misleading you.

Perpendicular lines have slopes whose product is −1, so the perpendicular to a slope of 2 is −0.5. Parallel lines share the same slope. These two facts solve most geometry problems that look like they need trigonometry.

Distance and midpoint come free

Distance = √[(x₂−x₁)² + (y₂−y₁)²]  ·  Midpoint = ((x₁+x₂)/2, (y₁+y₂)/2)

The distance formula is Pythagoras applied to the rise and the run, which is why the triangle calculator solves the same problem from a different angle. For the points above, the distance is √180, about 13.4164, and the midpoint is (5, 9).

Where slope shows up outside a textbook

Road signs use gradient as a percentage, and so do railway grades, usually expressed as 1 in 50 rather than 2%. Roofs use rise per 12 units of run β€” a 6:12 roof is a slope of 0.5 β€” which is exactly what the roofing calculator converts into a pitch multiplier. Drainage pipes are specified as a fall, commonly 1 in 40 for waste. Accessibility standards cap ramps at 1:12, about 8.3%, with the ADA and most building codes using that figure.

In data rather than geometry, slope is the rate of change: the coefficient in a linear regression is a slope, measured in units of y per unit of x. The interpretation is identical, which is why a line fitted through a scatter of points answers β€œhow much does y change when x goes up by one”.

A worked example

A drainage run must fall 1 in 80 over 24 metres. The slope is 0.0125, the gradient is 1.25%, the angle is 0.72 degrees, and the total fall is 0.3 metres β€” so the outlet sits 300 mm below the inlet. If the available drop is only 200 mm, the gradient achievable is 1 in 120, flatter than the specification, and the pipe diameter or the route has to change. The arithmetic is trivial; getting the direction of the inequality right is what matters on site.

Two neighbours worth knowing: the triangle calculator, for the question this one leads into, and the quadratic formula calculator, which answers it from the other direction.

Frequently Asked Questions (FAQs)

How do I find the slope between two points?

Subtract the y-coordinates, subtract the x-coordinates in the same order, and divide the first by the second. Keeping the order consistent is what matters β€” reversing both gives the same answer, reversing only one gives the wrong sign.

What is the difference between slope, gradient and angle?

They describe the same steepness in different units. Slope is the raw ratio, gradient is that ratio as a percentage, and the angle is its arctangent in degrees. A slope of 0.5 is a 50% gradient and 26.57 degrees.

Is a 100% gradient vertical?

No, it is 45 degrees β€” one unit up for every unit across. Gradient is a ratio and has no ceiling, so a 200% gradient is 63.43 degrees and vertical is infinite gradient, which is why vertical lines have an undefined slope rather than a very large one.

What is the slope of a vertical line?

Undefined, because the run is zero and division by zero has no result. A vertical line is written x = k instead of y = mx + c. A horizontal line is the opposite case and has a perfectly well-defined slope of zero.

How do I find the equation of a line from two points?

Work out the slope, then substitute either point into y = mx + c and solve for c. Through (2, 3) and (8, 15) the slope is 2, c is minus 1, and the equation is y = 2x minus 1.

What slope is perpendicular to a given line?

The negative reciprocal: flip the fraction and change the sign. Perpendicular to a slope of 2 is minus 0.5, and the two slopes multiply to minus 1. Parallel lines simply share the same slope.

How do I convert a roof pitch to a slope?

Roof pitch is given as rise per 12 units of run, so divide the rise by 12. A 6:12 pitch is a slope of 0.5, a 50% gradient and 26.57 degrees. The roofing calculator turns the same pitch into the area multiplier you need for materials.