Slope Calculator
Calculate the slope between two points.
What this calculator does
This tool works out the slope of a straight line between two points. Enter each point as an across value (x) and an up value (y), and you get the rise divided by the run.
Use it for graphing homework, roof pitch, the grade of a driveway or ramp, and checking that the ground drains away from your house.
A worked example
Ravi is replacing the shingles on his house in Kingston and needs the roof pitch. Working from the attic, he holds a level flat with one end touching the underside of a rafter. He measures 12 inches along the level. At that mark, the rafter is 5 inches above the level.
He enters the start of the level as point 1, at zero and zero, and the mark as point 2. The slope is 0.4167. Roofers call this a 5 in 12 pitch. He checks it against the installation instructions for the shingles he wants.
How we work it out
Slope is the rise divided by the run. The rise is the change in height, y2 minus y1. The run is the change across, x2 minus x1. We divide the first by the second and show four decimal places.
If both points have the same x value, the line goes straight up and down. Dividing by a run of zero has no answer, so the calculator shows Undefined (vertical line) instead of a number.
Reading the result
- A positive slope rises as you move right.
- A negative slope falls as you move right.
- A slope of zero is perfectly flat.
- Undefined means a vertical line, with no run at all.
The bigger the number, ignoring any minus sign, the steeper the line. A slope of 1 rises exactly as much as it runs. To turn a slope into a percent grade, the way road signs and driveway plans show it, multiply by 100. A slope of 0.08 is an 8% grade.
Rise over run around the house
Roof pitch is usually given as inches of rise per foot of run. Enter a run of 12 inches as the x value of point 2, and the rise as its y value.
Ground around a house should slope away from the foundation so water drains off. Drive one stake near the wall and another farther out, and tie a level string between them. Measure from the string down to the ground at each stake. Use the distance between the stakes as the run and the difference in the two readings as the rise. Your municipality may have rules on lot grading, so check before you change the ground level.
Wheelchair ramps have a maximum slope set by building codes and accessibility standards. Check your provincial code before you build one.
Common mistakes
- Subtracting in a different order on the top and bottom. Take point 1 away from point 2 for both the rise and the run.
- Mixing units, such as a rise in inches and a run in feet. The slope will be off by a factor of 12.
- Confusing slope with angle. A slope of 1 is a 45 degree angle, but doubling the slope does not double the angle.
- Confusing slope with length. For the length of the line between the points, use the distance calculator.
What this does not include
- Curved lines
- The angle of the line in degrees
- The length of the line between the points
- The y-intercept or the equation of the line
- Converting units, so the rise and run must use the same one
Common questions
What does a negative slope mean?
The line goes down as you move to the right. A slope of minus 0.5 drops half a unit for every unit across. On a lot plan where x measures the distance out from the house, a negative slope is what you want, because water runs downhill and away from the walls.
Why does the calculator say undefined?
Both points have the same x value, so the run is zero. The line is vertical, like a wall or a flagpole. Dividing any rise by zero has no answer, so there is no number to show. A horizontal line is different: its rise is zero and its slope is exactly zero.
Does it matter which point I enter first?
No. If you swap the two points, the rise and the run both change sign, and the two minus signs cancel out. You get the same slope either way. What matters is that you keep each x value with its own y value.
How do I find the slope from an equation like y = 2x + 3?
The number in front of x is the slope, so here it is 2. To check, pick two x values, work out y for each, and enter both points. With x values of 0 and 1, the points are (0, 3) and (1, 5), and the slope comes out as 2.
How do I change a slope into an angle?
Use the inverse tangent, often marked tan with a small minus 1, on a scientific calculator set to degrees. Enter the slope and press that key. The answer is the angle the line makes with flat ground. This tool gives the slope only, not the angle.
Sources
- NIST Guide to the SI, Appendix B.8: Factors for Units Listed Alphabetically, National Institute of Standards and Technology
Last reviewed October 18, 2026. How we check our numbers.
This is an estimate to help you plan. It is not financial, medical, or legal advice. Talk to a professional before you make a big decision.