The slope formula
The slope of a line tells you how steep it is and which way it goes. It is the change in y (the rise) divided by the change in x (the run) between any two points on the line.
A positive slope climbs from left to right, a negative slope falls, a slope of 0 is a flat (horizontal) line, and a vertical line has an undefined slope because its run is zero.
Once you know the slope, the calculator works out everything else about the line:
Distance = √((x₂ − x₁)² + (y₂ − y₁)²) · Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
y-intercept b = y₁ − m × x₁, so the line is y = mx + b
The slope is shown as an exact fraction when the inputs allow it. Decimal coordinates are converted exactly, so points such as (0.1, 0.1) and (0.4, 0.2) give a slope of 1/3 rather than 0.333333.
Worked examples
Example 1: a positive slope. Points (−2, 1) and (4, 5).
- Rise = 5 − 1 = 4. Run = 4 − (−2) = 6. Slope m = 4 ÷ 6 = 2/3 (about 0.6667).
- b = 1 − (2/3)(−2) = 1 + 4/3 = 7/3, so the line is y = (2/3)x + 7/3.
- Angle = arctan(2/3) ≈ 33.69°. Distance = √(6² + 4²) = √52 ≈ 7.211. Midpoint = (1, 3).
- Standard form, with whole numbers: 2x − 3y = −7.
Example 2: a negative slope. Points (1, 4) and (3, 0).
- m = (0 − 4) ÷ (3 − 1) = −4 ÷ 2 = −2.
- b = 4 − (−2)(1) = 6, so y = −2x + 6. The line crosses the x-axis at x = 3.
- Angle = arctan(−2) ≈ −63.43°, which is the same as 116.57° measured anticlockwise from the positive x-axis.
Example 3: a wheelchair ramp. A ramp rises 0.5 m over a horizontal run of 6 m.
- m = 0.5 ÷ 6 ≈ 0.0833, a grade of 8.33% and an angle of about 4.76°.
- That is a 1:12 ratio, the steepest running slope the US 2010 ADA Standards allow for a ramp.
Example 4: finding a second point. Start at (0, 0) and move 5 units along a line with slope 3/4. The run is 5 ÷ √(1 + 0.75²) = 4 and the rise is 0.75 × 4 = 3, so the new point is (4, 3), or (−4, −3) in the other direction. Choose Point + slope + distance to do this with any slope or angle.
Slope, angle and grade compared
People describe steepness in different ways. Maths classes use slope, surveyors and road signs use grade, and builders often use an angle or a ratio. This table converts between them.
| Slope (m) | Ratio | Grade | Angle |
|---|---|---|---|
| 0.05 | 1 : 20 | 5% | 2.86° |
| 0.0833 | 1 : 12 | 8.33% | 4.76° |
| 0.1 | 1 : 10 | 10% | 5.71° |
| 0.25 | 1 : 4 | 25% | 14.04° |
| 0.3333 | 1 : 3 | 33.3% | 18.43° |
| 0.5 | 1 : 2 | 50% | 26.57° |
| 1 | 1 : 1 | 100% | 45° |
| 2 | 2 : 1 | 200% | 63.43° |
| 10 | 10 : 1 | 1,000% | 84.29° |
Notice that a 100% grade is only 45°, not vertical. A vertical line would have an infinite grade.
Three ways to write the equation
The calculator gives the same line in three common forms:
| Form | Pattern | Example 1 line |
|---|---|---|
| Slope-intercept | y = mx + b | y = (2/3)x + 7/3 |
| Point-slope | y − y₁ = m(x − x₁) | y − 1 = (2/3)(x + 2) |
| Standard | Ax + By = C | 2x − 3y = −7 |
Slope-intercept form is the easiest to graph. Point-slope form is quickest to write when you already know a point and the slope. Standard form uses whole numbers, which many textbooks prefer for final answers.
Tips and common mistakes
- Keep the order the same. If you subtract y₁ from y₂ on top, subtract x₁ from x₂ underneath. Mixing the order flips the sign of the answer.
- Watch double negatives. 4 − (−2) is 6, not 2. Writing the brackets in helps.
- Simplify fractions. 4/6 and 2/3 are the same slope; the calculator always reduces.
- Undefined is not zero. A vertical line (same x for both points) has no slope, while a horizontal line (same y) has a slope of 0.
- Parallel and perpendicular lines. Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line perpendicular to slope 2/3 has slope −3/2.
Related calculators
Roof pitch is a slope too: a 6/12 pitch is a slope of 0.5. The roofing calculator turns pitch into roof area. For the area of shapes between lines, use the area calculator. If your slope is a messy fraction, the fraction calculator can simplify or combine it, and the scientific calculator handles arctan and square roots directly.