Slope calculator
A slope of 2 means the line rises two units for every one across. That is 63.4° from horizontal and a grade of 200%. Road signs use grade, surveyors use degrees, and algebra homework wants the plain ratio.
Slope is rise over run: the change in y divided by the change in x. For the points (1, 2) and (4, 8) the rise is 6 and the run is 3, so the slope is 2 and the line is y = 2x. A vertical line has no slope at all, because its run is zero and division by zero is undefined.
How to use it
The angle and the grade are easy to confuse. A 100 per cent grade is a 45° slope rather than a vertical wall: grade is the tangent of the angle written as a percentage, so the two only track each other while both are small. Roads are signed in grade, so a 10 per cent hill climbs one metre for every ten travelled horizontally, an angle of 5.71°. Builders use a third notation again, the ratio: the 1:12 that the ADA sets as the steepest a new ramp may be is 8.33 per cent grade and 4.76°, and entering the points 0,0 and 12,1 puts all three on screen at once.
The edges of the model are where a slope calculator earns its keep, and this one shows them rather than hiding them. Give it two points with the same x and the slope and the grade both go to a dash, because dividing by a run of zero has no answer, while the angle still reads 90° and the distance and the midpoint are as valid as ever; the equation switches to the x = form, which is the only way to write a vertical line. Give it the same point twice and everything collapses: zero distance, zero rise, zero run, and an equation of x = that point.
One surprise is worth expecting. The slope, the distance and the midpoint do not care which point you enter first, but the angle does. It is measured as the direction of travel from the first point to the second, so reversing them rotates it by 180°: the default pair reads 63.435°, and entered the other way round it reads −116.565° while the slope stays at exactly 2. If you only want the incline, read the angle from the lower point to the higher one.
What people use it for
- Turning a road grade off a signpost into degrees, or back again
- Checking a ramp against a maximum gradient before building it
- Working out the fall needed along a drainage or gutter run
- Writing the equation of a line through two plotted points
- Taking the midpoint and the distance off the same pair of coordinates
- Converting a builder’s 1:20 into the percentage a spec sheet asks for
Questions
The line is vertical, so the slope and the grade both show a dash and the equation is reported as x equals that value rather than as y = mx + b.
Because the angle is measured from the two differences directly rather than from their ratio, and a vertical line has a perfectly well defined direction even though its slope does not exist.
The line falls from left to right. Read left to right, the angle comes back negative too, measured below the horizontal.
Not for the slope, the grade, the distance, the midpoint or the equation. Swapping them flips the sign of the rise and the run together, and the ratio between them is unchanged.
The angle reports the direction from the first point to the second, so reversing the pair turns it through 180°. 63.435° becomes −116.565° for the same line.
Pythagoras on the rise and the run: the square root of rise squared plus run squared. It carries whatever units your coordinates are in.
Grade is rise over run as a percentage; the angle is the arctangent of that same ratio. They agree closely below about 10 per cent and diverge fast after it: 100 per cent is 45°, and no grade can reach 90°.
Under the ADA Standards a new ramp run may not be steeper than 1:12, which is 8.33 per cent or 4.76°, with a maximum rise of 30 inches per run. Existing buildings may go to 1:10 or 1:8 only within tight limits on rise.
As two points: 0,0 and 20,1. Run first, rise second. The grade row then reads 5 per cent and the angle 2.86°.
Zero. The equation comes back as y = 0x + b, which is a slightly literal way of writing y = b, and the angle and grade are both zero.
Take the negative reciprocal. A slope of 2 is perpendicular to −0.5. Parallel lines simply share the same slope.
To keep a slope like 0.0833 readable while still distinguishing it from 0.08. The underlying value is exact, so use the slope row rather than the equation for further arithmetic.