On This Page
- Rise over run
- Three ways to write the line
- Decimal, percent, degrees and pitch
- Slope targets for ramps, roofs, drains and driveways
- Five lines, worked
- How the calculator is verified
- FAQ
Rise Over Run
Slope tells you how far a line moves up or down for each step to the right. A positive slope climbs from left to right, a negative one falls, zero is flat and a vertical line is undefined because its run is zero. Positive vs negative slope shows how to read the sign at a glance.
Enter two points and the calculator returns the slope, angle, percent grade, y-intercept, line equation and a graph. The order of the points does not matter, as long as you subtract in the same order top and bottom. Read slope from the coordinates, not from how steep a stretched graph looks. The straight-line gap between the same points also appears; the Distance Calculator adds 3D and latitude/longitude modes.
Three Ways to Write the Line
| Form | Looks like | Use it when |
|---|---|---|
| Slope-intercept | y = mx + b | You want the slope m and the y-axis crossing b. The calculator gives this. |
| Point-slope | y − y1 = m(x − x1) | You know the slope and one point |
| Standard | Ax + By = C | A textbook gives it; the slope is −A/B and the intercept is C/B |
A slope of 3 through (2, 5) gives y − 5 = 3(x − 2), which expands to y = 3x − 1. And 3x + 2y = 10 rearranges to y = −1.5x + 5. A vertical line has no slope-intercept form, so it is written x = constant.
Decimal, Percent, Degrees and Pitch
These are four ways of stating the same steepness. Percent = slope × 100, angle = arctan(slope), and roof pitch is rise per 12 of run, so X:12 = slope × 12.
| Slope | Percent | Angle | Where you see it |
|---|---|---|---|
| 0.01 | 1% | 0.57° | Low end for drains and driveways |
| 0.0833 (1:12) | 8.33% | 4.76° | ADA maximum for a wheelchair ramp |
| 0.25 (3:12) | 25% | 14.04° | Low-slope residential roof |
| 0.333 (4:12) | 33.3% | 18.43° | Common roof pitch |
| 0.5 (6:12) | 50% | 26.57° | Steeper roof |
| 0.667 (8:12) | 66.7% | 33.69° | Steep roof |
| 1.0 (12:12) | 100% | 45° | Rise equals run |
For a roof, enter (0, 0) and (12, rise) and multiply the slope by 12 for the pitch. The arctan step is the same one used to find angles in the Triangle Calculator.
Slope Targets for Ramps, Roofs, Drains and Driveways
- Wheelchair ramps: no steeper than 1:12 under the ADA, so a 6-inch rise needs 72 inches of run. Codes also set landings, handrails and surfaces, so treat this as the math check only.
- Driveways: usually 1–5%. Below 1% water pools at the garage, and above about 15% is hard going in the wet.
- Drain pipes: plumbing codes generally call for 1/4 inch per foot (about 2%) on small pipes and allow 1/8 inch per foot (about 1%) on larger ones such as 4-inch lines. Check your local code.
- Gutters: about 1/4 to 1/2 inch of drop per 10 feet, 0.2–0.4%.
- Landscape grading: at least 2% away from a foundation, and 5–10% for berms and swales.
Five Lines, Worked
- (1, 2) and (7, 6): rise 4, run 6, slope 0.6667.
- (−2, 8) and (4, 2): rise −6, run 6, slope −1, falling left to right.
- (2, 5) and (6, 13): slope 8 ÷ 4 = 2. Then 5 = 2(2) + b gives b = 1, so y = 2x + 1.
- (3, 1) and (3, 9): run 0, so the slope is undefined. The line is vertical, x = 3.
- A ramp rising 1.5 ft over 12 ft: 0.125, or 12.5%, well over the ADA's 8.33%.
A rise of 2 over a run of 10 is 0.2, 20%, or about 11.31°. In Excel, =SLOPE(y_range, x_range) fits a line through many points, =(B2-B1)/(A2-A1) handles two, and =INTERCEPT(y_range, x_range) gives b.
How the Calculator Is Verified
Slope and distance are computed from the same dx and dy values but by two separate formulas that don't feed into each other: slope is dy divided by dx, distance is the square root of dx squared plus dy squared, so a distance figure appears next to the slope on every calculation, including ones where the slope itself is undefined. When dx is 0 the line is vertical, and the code returns the literal string "Undefined" for slope along with a 90 degree angle and the equation x = [value], instead of dividing by zero. If both points are identical (dx and dy both 0), the calculator skips computation entirely and shows an explicit message that the two points don't define a line.
Frequently Asked Questions
How do you calculate percent slope and grade?
Multiply decimal slope by 100: slope 0.08 = 8% grade. A road sign reading "8% grade" means the road rises (or falls) 8 meters for every 100 meters of horizontal distance. To convert percent back to decimal, divide by 100.
What does undefined slope mean, and how is it different from zero slope?
A vertical line has undefined slope because both x-values are equal, making the run zero, division by zero is undefined. A horizontal line has zero slope because the rise is zero while run is nonzero: 0 ÷ run = 0. Horizontal = zero slope; vertical = undefined slope.
References
- Slope, Wolfram MathWorld: formal mathematical definition of slope, rise-over-run formula, and relationship to the derivative.
- Slope of a Straight Line, Math is Fun: visual explanation of positive, negative, zero, and undefined slope with worked examples.
- ADA Standards for Accessible Design, US Access Board: official source for wheelchair ramp slope requirements (1:12 maximum) and related accessibility standards.