Skip to content

Slope Calculator: Two Points or Rise Over Run

Slope calculator: two points or a rise and run give the slope as a decimal and fraction, plus the angle, percent grade and line equation.

Calculate from

Slope (m)

1.5= 3/2 · rise 6 ÷ run 4
Angle of inclination
56.30993247°
Percent grade
150%
Ratio (rise : run)
1 : 0.666667
Distance between points
7.211102551
Line equation
y = 1.5x + 0.5
y-intercept
0.5
x-intercept
−0.3333333333

How to use the Slope Calculator

  1. Choose Two points to use coordinates, or Rise and run for a ramp, roof or road.
  2. Enter the coordinates (x₁, y₁) and (x₂, y₂), or the vertical rise and horizontal run in the same unit.
  3. Read the slope as a decimal and a fraction, with the angle, percent grade and 1:N ratio below it.
  4. With two points, the result also gives the distance between them and the line equation y = mx + b.

Formula

m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run · θ = arctan(m) · grade = m × 100%

Where:

m
Slope (gradient): how much y changes for each 1 unit of x. Unitless.
(x₁, y₁), (x₂, y₂)
Two different points on the line
rise
Vertical change, y₂ − y₁ (negative when the line goes down)
run
Horizontal change, x₂ − x₁, in the same unit as the rise
θ
Angle of inclination from the horizontal, in degrees
b
y-intercept in y = mx + b: b = y₁ − m × x₁

When x₁ = x₂ the line is vertical: the run is 0, so the slope is undefined and the angle is 90°. A horizontal line has slope 0. A 1:N ratio means N units of run for every 1 unit of rise.

Worked example

A driveway climbs 1.5 m over a horizontal distance of 20 m. What are its slope, grade and angle?

  1. m = rise ÷ run = 1.5 ÷ 20 = 0.075 (as a fraction, 3/40).
  2. Grade = 0.075 × 100 = 7.5%.
  3. θ = arctan(0.075) ≈ 4.289°.
  4. Ratio 1 : (1 ÷ 0.075) = 1 : 13.33, and the sloped surface is √(20² + 1.5²) ≈ 20.06 m long.

The driveway has a slope of 0.075, a 7.5% grade and an angle of about 4.29°.

How to find the slope of a line with two points

Slope says how far a line climbs or drops for every step it moves sideways: rise divided by run. Schools in the UK, Australia and India call the same number the gradient, so anyone looking for a gradient calculator is in the right place. With Two points selected, any two different points on the line are enough, negative and decimal coordinates included.

Take the points (−3, 4) and (2, −6):

  1. Rise: −6 − 4 = −10. Run: 2 − (−3) = 5.
  2. Slope: m = −10 ÷ 5 = −2. The line falls 2 units for each unit it moves right.
  3. Intercept: b = y₁ − m × x₁ = 4 − (−2 × −3) = 4 − 6 = −2.
  4. Equation: y = −2x − 2. Setting y = 0 gives the x-intercept, x = −1.
  5. Distance between the points: √(5² + 10²) = √125 ≈ 11.18 units.
  6. Angle: arctan(−2) ≈ −63.43°, the minus sign meaning the line points downward.

Swapping the two points flips the sign of both rise and run, so the slope stays −2. The usual slip is mixing the order, such as (y₂ − y₁) ÷ (x₁ − x₂), which reverses the sign.

Rise over run, percent grade and degrees

One steepness can be written five ways, and all five are shown together: the decimal m, a fraction in lowest terms, the angle from the horizontal, the percent grade and a 1:N ratio. They are linked by three formulas: grade = m × 100, angle = arctan(m), and N = 1 ÷ m.

Rise over runRatioPercent gradeAngle
1/48 (¼ inch per foot)1:482.08%1.19°
1/201:205%2.86°
1/121:128.33%4.76°
1/101:1010%5.71°
4/12 roof pitch1:333.33%18.43°
6/12 roof pitch1:250%26.57°
12/12 roof pitch1:1100%45°

The fraction is exact: inputs are scaled to whole numbers and reduced, so 0.75 over 1.5 shows as 1/2. The angle follows the arctangent, which is why it does not keep pace with the grade. A 1:12 ratio is 8.33%, not 12%, and a 100% grade is a 45° incline, not a wall.

Going from an angle back to a slope uses m = tan(θ). There is no angle input, so find the tangent on a scientific calculator and enter it as the rise over a run of 1.

Slope of a ramp, roof or drain

Rise and run is the mode for physical slopes. Enter the vertical change and the level distance in the same unit; the unit cancels, so slope itself has none.

Ramp. A door sits 24 inches above the path and there are 22 feet of run available. Convert first: 22 ft = 264 in. The slope is 24 ÷ 264 = 1/11, about 0.0909, a 9.09% grade or roughly 5.19°. That is steeper than the 1:12 maximum in the US ADA Standards. At 1:12, a 24-inch rise needs 24 × 12 = 288 inches of run, which is 24 feet. Codes in other countries differ, so treat 1:12 as a US reference only.

Roof. Pitch is inches of rise per 12 inches of run, so enter the first number as the rise and 12 as the run. The slope length in the results is the rafter length for that run, before any overhang: a 6/12 roof over 12 ft of run needs about 13.42 ft of rafter.

Drain. A pipe that falls a quarter inch per foot is entered as a rise of −0.25 and a run of 12. The result is a slope of −1/48, a grade of about −2.08% and a ratio of 1:48.

Measure the run horizontally, not along the surface, and never mix inches of rise with feet of run.

Positive, negative, zero and undefined slope

  • Positive: the line climbs from left to right.
  • Negative: it falls from left to right. In rise-and-run mode, type a negative rise for a downhill slope.
  • Zero: a horizontal line, y = c. The grade is 0% and the ratio reads Flat.
  • Undefined: a vertical line. Both points share one x value, the run is 0 and rise ÷ run would divide by zero. The slope is reported as Undefined, the angle as 90° and the line as x = c.

Rise-and-run mode needs a run greater than zero, so a vertical line can only be entered as two points. Two identical points do not define a line and produce an error message.

Assumptions

Coordinates, rise and run may be up to ±1 trillion. The line equation and the intercepts appear in Two points mode only. Results come from 40-digit decimal arithmetic and are displayed rounded to 10 significant digits. For the length of a segment and its midpoint, use the distance calculator. Building-code limits mentioned here are for orientation only; always confirm against the code that applies where you build.

Frequently asked questions

How do I find the slope of a line with two points?

Subtract the first point's coordinates from the second's and divide: m = (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (5, 8), m = 6 ÷ 4 = 1.5. It does not matter which point you call the first, as long as you use the same order on top and bottom.

How do I calculate slope percentage?

Divide the rise by the run and multiply by 100. A path that climbs 1 m over 12 m of level distance has a grade of 1 ÷ 12 × 100 ≈ 8.33%. Percent grade is not the angle: a 100% grade is a 45° incline, not a vertical wall, and a 10% grade is only about 5.71°.

How do I convert slope to degrees?

Take the arctangent of the slope: θ = arctan(m). A slope of 0.5 is about 26.57°, a slope of 1 is exactly 45°, and a 10% grade (m = 0.1) is about 5.71°. The angle does not rise in step with the slope, so doubling the slope does not double the angle.

How do I calculate a slope ratio?

Divide the run by the rise to get N in 1:N, the run needed for each unit of rise. A rise of 1.5 m over 20 m is 1:13.33. In the United States the ADA Standards allow at most 1:12 for wheelchair ramps (8.33%, about 4.76°); other countries set their own limits, so check your local building code.

How do I find the slope and y-intercept?

Find the slope from two points, then put one point into b = y₁ − m × x₁. For (1, 2) and (5, 8), m = 1.5 and b = 2 − 1.5 × 1 = 0.5, so the line is y = 1.5x + 0.5. In Two points mode the equation, the y-intercept and the x-intercept (here about −0.33) are all listed.

How do you convert an angle to slope?

Take the tangent: m = tan(θ). An angle of 30° is a slope of about 0.5774, a 57.74% grade, and 45° is a slope of exactly 1. There is no angle input here, so work out the tangent first and enter it as the rise with a run of 1 to see the grade and ratio.

Last updated: