Slope Calculator: Find the Slope of a Line, Four Ways
Enter two points, a point and a slope, the equation y = mx + b, or a plain rise and run. Whichever you start from, you get the slope, the angle, the percent grade, the ratio, both intercepts, the equation of the line and a plot, with every step shown underneath.
How to use the slope calculator
Pick the tab that matches what you already have. You do not need to rearrange anything or work anything out first.
- Two Points. You have two coordinates the line passes through. This is the most common case.
- Point & Slope. You know how steep the line is and one point it goes through. Use this when you are building the line rather than measuring it.
- Slope Intercept. You already have m and b, and you want everything else that follows from them.
- Rise Over Run. You measured a height and a distance with a tape. No coordinates needed.
- Choose your tab.
- Type your numbers in. Fractions are fine, so
3/4is read as 0.75. Negatives are fine too. - Press Calculate.
- Read the answer panel on the right. Open the working panel below it if you want to see each step.
Switching tabs does not wipe what you have typed, so you can move between them and compare.
What you get back
One press calculates everything. The answers you came for appear first, with nothing to convert by hand. Open More results for the radians, the rise, the run and the distance, or Show calculation steps to see the arithmetic line by line.
- The slope as a decimal, and as a tidy fraction when one exists. 0.75 is also shown as 3/4, which is easier to plot and easier to read off a drawing.
- The angle in degrees and in radians. Degrees for site work, radians if you are heading into calculus.
- The percent grade, which is what road, driveway and drainage work runs on.
- The ratio, written the way ramps and pipework are specified.
- The height and the distance that produced the answer, so you can check the calculator read your input the way you meant it.
- The straight line distance between your two points, which is the surface length rather than the flat measurement.
- Both intercepts, where the line crosses each axis.
- The equation of the line, written three ways. Different jobs and different teachers ask for different forms, so you get all three rather than having to rearrange one into another.
- A plot with the height and distance marked on it, so you can see at a glance whether the answer matches the shape you expected.
- The working, step by step, in a panel you can open or ignore.
How precise the numbers are
The slope is shown to six decimal places. Everything else is shown to four or five.
What matters more is that nothing is rounded before it is used again. The angle, the grade and the equation are all worked out from the full value, not from the shortened number on screen. So if you take the slope shown here, round it, and convert it yourself, you may land a digit or two away from the angle on screen. That gap is the rounding you did, not a disagreement about the maths.
About units
This calculator does not ask for units, because slope does not need them. Six feet of height over twelve feet of distance gives exactly the same 0.5 as six inches over twelve inches. The units cancel each other out.
The one thing that will catch you out is mixing them. Height in inches and distance in feet gives an answer twelve times too big, and it will look perfectly reasonable on screen. Convert first, then type.
The slope formula
m = (y₂ − y₁) ÷ (x₂ − x₁)
Slope is how steep a line is. It is how far the line climbs or falls for every step it takes sideways, and that is the whole idea.
The top of the formula is the vertical change between your two points. The bottom is the horizontal change over that same stretch. Divide the first by the second and you have it. This is the standard slope formula for a line, written the same way in any algebra course.
You will see the same formula written as Δy / Δx, or typed out as y2-y1/x2-x1, or described in words as the vertical over the horizontal. They are not different formulas. They are the same one in different handwriting.
Mathematicians call it m. Roofers call it pitch, surveyors call it grade, plumbers call it fall, and in Britain it is a gradient. Same measurement, different hats, which is why one tool can answer a homework question and a drain run without changing anything but the units you measured in.
How to calculate slope by hand
Take the points (2, 3) and (6, 11).
- Subtract the y values: 11 − 3 = 8. The line climbs 8.
- Subtract the x values in the same order: 6 − 2 = 4. It travels 4 sideways.
- Divide: 8 ÷ 4 = 2.
A slope of 2 means the line climbs two units for every one unit it moves right. Steep, but nowhere near vertical.
Now one that falls, (−1, 5) and (3, −3). The vertical change is −3 − 5 = −8. The horizontal change is 3 − (−1) = 4. The slope is −2, negative because the line drops as it goes right.
It does not matter which point you call the first one. What matters is that you keep the order the same on the top and the bottom. Swap it in one place and not the other and your answer comes out the right size with the wrong sign.
Reading the same answer four ways
The plot under the answer draws the line for you. To sketch one from a different starting point, or to read a slope straight off a grid, use the slope graph.
If the number itself is the puzzle rather than the arithmetic, and what you actually want is a plain account of what slope is and why the same hill gets quoted as a ratio, a percentage and an angle, start with what slope is.
One measurement, four notations. Every trade grew up using a different one, which is why the same hill gets described four ways by four people who all agree. The US Geological Survey sets out the same two conversions for fieldwork, showing how to get percent slope and angle of slope from a rise and a run measured on the ground.
- Decimal. The raw number the formula gives you. 0.5.
- Percent. The decimal times 100. 50%. Roads, driveways and drainage.
- Degrees. The angle up from level. 26.57°. The slope is the tangent of that angle, which is the whole reason you move between the two with tan and arctan.
- Ratio. One unit up for every so many along. 1 : 2. Ramps and pipework.
The one to watch is percent against degrees. They are not the same number and they are not close. A 50% grade is 26.57°, and 100% is 45°, not 90°. Reading a percent as an angle is the single most common slope mistake there is, and it happens on site as often as it happens in class.
Ratios come with a trap of their own. Written 1 : 12 it means one unit up for every twelve along, and that is how ramps and pipe runs are specified. In earthworks and on civil drawings you will meet 3 : 1, and there it usually means three along for every one up, which is the reverse order and a far shallower slope than it looks at first glance. If a drawing does not say which way round it reads, work out which one gives a sensible number for the job before you build to it. This calculator prints the ratio card in reduced rise : run, which is how a maths class writes it, and puts the 1 : n form beside it so a ramp or a pipe spec can be read straight off. A slope of 2 shows as 2 : 1, or 1 : 0.5.
Here is the range you will actually meet, lined up against pitch so it works on a drawing as well as on paper.
| Pitch | Slope | Percent | Angle | Ratio |
|---|---|---|---|---|
| 1/12 | 0.083 | 8.33% | 4.76° | 1 : 12 |
| 2/12 | 0.167 | 16.67% | 9.46° | 1 : 6 |
| 3/12 | 0.250 | 25.00% | 14.04° | 1 : 4 |
| 4/12 | 0.333 | 33.33% | 18.43° | 1 : 3 |
| 5/12 | 0.417 | 41.67% | 22.62° | 1 : 2.4 |
| 6/12 | 0.500 | 50.00% | 26.57° | 1 : 2 |
| 7/12 | 0.583 | 58.33% | 30.26° | 1 : 1.71 |
| 8/12 | 0.667 | 66.67% | 33.69° | 1 : 1.5 |
| 9/12 | 0.750 | 75.00% | 36.87° | 1 : 1.33 |
| 10/12 | 0.833 | 83.33% | 39.81° | 1 : 1.2 |
| 11/12 | 0.917 | 91.67% | 42.51° | 1 : 1.09 |
| 12/12 | 1.000 | 100.00% | 45.00° | 1 : 1 |
The shallow end
Most real work sits below the bottom row of the table above. Drainage, paths, roads and ramps all live in single digit percentages, where the angles are much smaller than people expect.
| Percent | Slope | Angle | Ratio | Roughly where you meet it |
|---|---|---|---|---|
| 1% | 0.010 | 0.57° | 1 : 100 | About the flattest you can drain water across |
| 2% | 0.020 | 1.15° | 1 : 50 | Common target for surface water away from a building |
| 3% | 0.030 | 1.72° | 1 : 33 | Gentle, barely noticeable underfoot |
| 4% | 0.040 | 2.29° | 1 : 25 | Noticeable on a long path |
| 5% | 0.050 | 2.86° | 1 : 20 | The most a walking surface may run under ADA 403.3. Steeper than this and 106.5 calls it a ramp |
| 6% | 0.060 | 3.43° | 1 : 17 | A signed hill on a road |
| 7% | 0.070 | 4.00° | 1 : 14 | A steep road sign in most countries |
| 8.33% | 0.083 | 4.76° | 1 : 12 | The steepest a ramp may run under ADA 405.2 |
| 10% | 0.100 | 5.71° | 1 : 10 | Hard work on foot with a load |
| 15% | 0.150 | 8.53° | 1 : 6.7 | Inside the range most driveway caps sit in, which is roughly 12 to 20 |
| 20% | 0.200 | 11.31° | 1 : 5 | Very steep for anything wheeled |
| 25% | 0.250 | 14.04° | 1 : 4 | Steep enough that surfacing becomes a problem |
| 33.3% | 0.333 | 18.43° | 1 : 3 | A typical cut or fill batter in earthworks |
Five reasons a slope calculation comes out wrong
A calculator will happily give you a confident number from bad input. These are the five that produce an answer that looks fine and is not.
- The distance was measured along the surface. The bottom of the formula is the flat horizontal distance, not the length of the slope itself. On anything steep those two are noticeably different, and using the wrong one makes your answer too shallow.
- The units were mixed. Inches on top, feet underneath. The answer comes out twelve times too big and looks perfectly plausible.
- One subtraction got flipped. Right size, wrong sign. If your line should be falling and the answer is positive, this is why.
- The two numbers went in upside down. It is the climb over the travel, not the other way round. If a steep line is reporting a small number, check this first.
- The line is vertical. For two distinct points on a vertical line, the run is zero while the rise is nonzero, so the slope calculation divides a nonzero number by zero and is undefined. There is no slope to report. This is not the same as a slope of nothing, which is a flat line, and the two get mixed up constantly.
If you want to see which of the four shapes your line is before you trust the number, the plot underneath the answer will show you in a second. A line climbing left to right has a positive slope, one falling has a negative slope, a flat line has a zero slope, and a vertical one has an undefined slope.
A falling line gives a negative angle, and that trips people up. A slope of −0.5 is reported as −26.565°. That is the angle measured from the positive x-axis, turning clockwise, which is the same direction the arctangent returns. If you want the direction the line points instead, measured anticlockwise the way a bearing is, add 180 and you get 153.435°. Both describe the same line. Which one you want depends on whether you are asking how steep it is or which way it goes.
How slope is used in construction
The formula does not change once you leave the graph paper. What changes is which of the four notations the trade uses, and what a code or a standard says the number has to be.
- Roofs are quoted as so many units of climb for every twelve of travel. Below two in twelve, asphalt shingles are outside what IRC section R905.2.2 rates them for, and the roof has to change to a system approved for low slope. That is usually a membrane, but standing seam metal is also permitted down to a quarter in twelve, and other products carry their own approvals. Which ones apply is a question for the product listing and your local code. The roof pitch calculator works in those units directly and gives you the rafter length with it.
- Ramps are quoted as a ratio. One in twelve is the maximum running slope in ADA 405.2, and ADA 405.6 caps a single run at thirty inches of rise, so anything taller needs a level landing before the ramp carries on. There is a wheelchair ramp calculator that checks both.
- Driveways are quoted as a percent. Caps vary by jurisdiction, commonly somewhere between twelve and twenty percent, so check the number your authority actually uses. You want at least one or two percent somewhere so water runs off instead of pooling against the garage.
- Drain pipe is quoted in fractions of an inch of fall for every foot of run. Too little fall can prevent reliable drainage. Pipe sizing and installation requirements also matter, so check the applicable plumbing code. The pipe slope calculator checks your number against the usual minimums.
Frequently asked questions
What is the formula for slope?
m = (y₂ − y₁) ÷ (x₂ − x₁). Subtract the two y values to get the vertical change, subtract the two x values in the same order to get the horizontal change, then divide the first by the second.
How do you find the slope between two points?
Label them (x₁, y₁) and (x₂, y₂), then work out (y₂ − y₁) ÷ (x₂ − x₁). For (2, 3) and (6, 11) that is (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2. It does not matter which point you call the first one, as long as you keep the order the same on the top and the bottom.
Why is a 100% grade only 45 degrees?
Because percent and degrees are measuring two different things. Percent compares how far you climb to how far you travel, so 100% means one unit up for one unit along. Draw that and you get a right triangle with two equal sides, and the corner between them is 45 degrees. Degrees measure the angle itself and stop at 90. Percent never stops. A vertical wall is 90 degrees and infinite percent.
What is a 2% slope in degrees?
1.15 degrees. That is a far smaller number than most people expect, which is exactly why the two get mixed up. For any other figure, divide the percent by 100 and take the arctangent. So 2 ÷ 100 = 0.02, and arctan(0.02) = 1.15°. The shallow slope table further up has the common ones already worked out.
Why do some people use percent and others use degrees?
It comes down to who has to read the number. Percent falls straight out of two measurements you can take with a tape, so roads, drainage and earthworks use it. Degrees need a protractor or a calculator, but they describe the angle directly, so anyone cutting or setting a piece of material usually wants them instead. Ski maps and cycling apps use both and often do not say which. Same hill either way, just written down differently.
Does a slope of 3:1 mean steep or shallow?
It depends who wrote it, which is why it causes arguments. In earthworks and civil drawings, 3:1 normally means three units across for every one up, so it is fairly shallow, around 18 degrees. On ramps and in plumbing the ratio is written the other way round, one up for every so many along, so 1:12 means one up for twelve across. If the drawing does not say, work out which reading gives a sensible number for the job and check with whoever drew it. The ratio card here gives you both: the reduced rise : run, and the 1 : n form beside it.
Why does this give a different answer to another calculator?
Almost always rounding. Plenty of tools round the slope before they use it to work out the angle, so a small difference at the start turns into a visible one at the end. This one does not round anything until the moment it prints. If you take the slope off the screen, convert it by hand and land a digit or two away, that gap is the rounding in the number you copied rather than a different answer. The other possibility is that one of you measured the horizontal distance along the surface rather than flat, which changes the answer itself rather than just the last digit.
Why does a vertical line have no slope?
For two distinct points on a vertical line, the run is zero while the rise is nonzero, so the slope calculation divides a nonzero number by zero and is undefined. Both points sit at the same x value, so the bottom of the formula becomes 0 and there is no number to report. That is different from a flat line, where the vertical change is zero and the answer is simply 0.