Slope Calculator

This slope calculator finds the slope between two points as a decimal and a fraction, writes the line in slope-intercept form, and gives the angle, percent grade and distance.

Slope Calculator inputs

Result

Enter your values to see the result.

  • Formula v1.0, unit-tested
  • Examples generated by the calculator
  • Updated
  • How we calculate
On this page

Formula

m = (y₂ − y₁) ÷ (x₂ − x₁); b = y₁ − m·x₁; θ = arctan(m)

(x₁, y₁), (x₂, y₂)
the two points on the line
m
the slope, rise divided by run
b
the y-intercept, where the line crosses the y-axis
θ
the angle the line makes with the positive x-axis

What slope measures

The slope of a line measures how steep it is and in which direction it goes. It’s the ratio of vertical change to horizontal change between any two points on the line, often remembered as rise over run:

m = (y₂ − y₁) ÷ (x₂ − x₁)

A positive slope rises from left to right, a negative slope falls, a slope of 0 is flat, and a vertical line has an undefined slope. The bigger the absolute value, the steeper the line. A slope of 3 is steeper than a slope of 1/2, and a slope of −3 is just as steep as 3, only falling instead of rising.

How to use the slope calculator

  1. Enter the coordinates of the first point (x₁, y₁) and the second point (x₂, y₂). Negative numbers and decimals are fine.
  2. The slope appears right away as a decimal, with a note saying whether the line rises, falls or is horizontal.
  3. Underneath, the slope calculator gives the slope as a fraction, the slope-intercept form y = mx + b (with an exact fractional version when it differs), the point-slope form, both intercepts, the angle with the x-axis, the percent grade, the distance between the points, the midpoint and the perpendicular slope.
  4. The steps show the rise, the run, the division, the intercept and the distance formula with your numbers in place.

How to find slope by hand

Take the points (1, −2) and (5, 10).

  1. Rise: y₂ − y₁ = 10 − (−2) = 12.
  2. Run: x₂ − x₁ = 5 − 1 = 4.
  3. Slope: m = 12 ÷ 4 = 3.
  4. Intercept: substitute one point into y = mx + b. −2 = 3 × 1 + b, so b = −5.
  5. Equation: y = 3x − 5. Check with the other point: 3 × 5 − 5 = 10.

The angle is arctan(3) ≈ 71.57°, and the distance between the points is √(4² + 12²) = √160 = 4√10 ≈ 12.65. That’s the Pythagorean theorem applied to the run and the rise, which the Pythagorean theorem calculator works out on its own.

Forms of a line equation

  • Slope-intercept form: y = mx + b. It’s the easiest form for graphing, since you start at b on the y-axis and step by the slope.
  • Point-slope form: y − y₁ = m(x − x₁). It’s handy when you know a point and the slope but not the intercept.
  • Standard form: Ax + By = C. For y = 3x − 5, that’s 3x − y = 5.

Slope, angle and percent grade

Slope can be written as a ratio, a decimal, a percent grade or an angle. They all describe the same steepness.

Rise : run Slope Grade Angle
1 : 48 0.0208 2.08% 1.19°
1 : 20 0.05 5% 2.86°
1 : 12 0.0833 8.33% 4.76°
1 : 8 0.125 12.5% 7.13°
1 : 4 0.25 25% 14.04°
1 : 2 0.5 50% 26.57°
3 : 4 0.75 75% 36.87°
1 : 1 1 100% 45°
2 : 1 2 200% 63.43°

Grade and angle aren’t proportional. A 100% grade is 45°, and a vertical wall would have an infinite grade.

Real-life uses

Wheelchair ramps

The 2010 ADA Standards require a ramp’s running slope to be no steeper than 1:12, so each inch of rise needs at least 12 inches of run. That’s a slope of about 0.0833, an 8.33% grade, or roughly 4.76°. To check a ramp, enter its start as (0, 0) and its end as (run, rise) in the same unit.

Roofs

Roof pitch is rise per 12 inches of run. A 4/12 pitch has a slope of 1/3, about 18.43°, and a 12/12 pitch is 45°. Rafter length then follows from the Pythagorean theorem.

Roads, driveways and drainage

Road signs give grades as percentages, so a 6% grade drops 6 ft for every 100 ft traveled horizontally. Patios and pipes are often laid at about 1/4 inch per foot (a slope of about 0.0208, or 2%) so that water drains away.

Rates of change

Any straight-line graph has a slope with units. On a distance-time graph the slope is speed. On a cost graph it’s the price per item. If a taxi charges $3 plus $2 per mile, the cost line has slope 2 and intercept 3. Percentages of change between two values are handled by the percentage calculator.

Common mistakes

  • Subtracting in different orders. If you compute y₂ − y₁ on top, you must compute x₂ − x₁ on the bottom. Mixing the order flips the sign.
  • Putting x on top. Slope is change in y over change in x, not the other way round.
  • Calling a vertical line’s slope 0. Horizontal lines have slope 0. Vertical lines have an undefined slope.
  • Confusing grade with degrees. A 10% grade is about 5.71°, not 10°.
  • Leaving the fraction unsimplified. 6/9 should be reduced to 2/3. The fraction calculator simplifies any fraction.

Glossary

  • Rise / run: vertical and horizontal change between two points.
  • y-intercept: the point where the line crosses the y-axis, (0, b).
  • Grade: slope expressed as a percent.
  • Perpendicular slope: the negative reciprocal, −1/m.

Worked examples

Slope between two points

Find the slope and equation of the line through (2, 3) and (6, 11).

Inputs: x₁ = 2; y₁ = 3; x₂ = 6; y₂ = 11

Rise: Δy = y₂ − y₁ = 11 − 3 = 8 Run: Δx = x₂ − x₁ = 6 − 2 = 4 m = Δy ÷ Δx = 8 ÷ 4 = 2 b = y₁ − m × x₁ = 3 − 2 × 2 = −1 θ = arctan(m) = arctan(2) = 63.4349° d = √(Δx² + Δy²) = √(4² + 8²) = 8.944272

Answer: Slope 2; line y = 2x − 1; angle 63.4349°; distance 8.944272.

A fractional, falling slope

The line through (−3, 4) and (6, −2) falls 6 units over a run of 9.

Inputs: x₁ = -3; y₁ = 4; x₂ = 6; y₂ = -2

Rise: Δy = y₂ − y₁ = −2 − 4 = −6 Run: Δx = x₂ − x₁ = 6 − (−3) = 9 m = Δy ÷ Δx = −6 ÷ 9 = −2/3 ≈ −0.666667 b = y₁ − m × x₁ = 4 − (−0.666667) × (−3) = 2 θ = arctan(m) = arctan(−0.666667) = −33.6901° d = √(Δx² + Δy²) = √(9² + (−6)²) = 10.816654

Answer: Slope −0.666667 (−2/3); line y = −(2/3)x + 2; angle −33.6901°; distance 10.816654.

Wheelchair ramp

A ramp rises 20 in over a horizontal run of 300 in (25 ft). What is its slope, grade and angle?

Inputs: x₁ = 0; y₁ = 0; x₂ = 300; y₂ = 20

Rise: Δy = y₂ − y₁ = 20 − 0 = 20 Run: Δx = x₂ − x₁ = 300 − 0 = 300 m = Δy ÷ Δx = 20 ÷ 300 = 1/15 ≈ 0.066667 b = y₁ − m × x₁ = 0 − 0.066667 × 0 = 0 θ = arctan(m) = arctan(0.066667) = 3.8141° d = √(Δx² + Δy²) = √(300² + 20²) = 300.665928

Answer: Slope 0.066667 (1/15); line y = (1/15)x; angle 3.8141°; distance 300.665928.

Vertical line

Edge case: both points have x = 5, so the run is 0.

Inputs: x₁ = 5; y₁ = -1; x₂ = 5; y₂ = 7

Rise: Δy = y₂ − y₁ = 7 − (−1) = 8 Run: Δx = x₂ − x₁ = 5 − 5 = 0 m = Δy ÷ Δx = 8 ÷ 0, which is undefined d = √(Δx² + Δy²) = √(0² + 8²) = 8

Answer: The line through (5, −1) and (5, 7) is vertical (x = 5); its slope is undefined.

Assumptions and limitations

  • Coordinates can be whole numbers, decimals or negatives between −1,000,000,000 and 1,000,000,000. The two points must be different.
  • When both points have the same x-value, the line is vertical and its slope is undefined. The calculator then gives the equation x = constant and an angle of 90°.
  • Decimal results are rounded to 6 decimal places, and angles and grades to 4 decimal places.
  • The slope and intercept are also found exactly as fractions by scaling decimal coordinates to whole numbers, so the exact equation (such as y = −(2/3)x + 2) is shown when it differs from the decimal one.
  • The angle is measured from the positive x-axis, between −90° and 90°. A falling line has a negative angle.
  • Percent grade is the slope × 100, the convention used for roads, ramps and drainage. It isn't the angle in degrees.

Frequently asked questions

How do you calculate slope with two points?

Subtract the y-values, subtract the x-values in the same order, and divide. For (2, 1) and (8, 4), m = (4 − 1) ÷ (8 − 2) = 3 ÷ 6 = 0.5. The order of the points doesn't matter as long as you keep it the same on the top and the bottom.

What does rise over run mean?

Rise is the vertical change between two points and run is the horizontal change. Slope = rise ÷ run. A rise of 3 over a run of 4 gives a slope of 0.75. The line climbs 3 units for every 4 units it moves to the right.

How do you find the y-intercept from the slope?

Substitute the slope and one point into y = mx + b and solve for b. With m = 0.5 and the point (2, 1), 1 = 0.5 × 2 + b, so b = 0. The calculator shows this step and the finished equation.

How do you calculate slope as a percentage?

Multiply the slope by 100. A road that rises 6 ft over 100 ft of horizontal distance has a slope of 0.06, a 6% grade. A 100% grade is a 45° angle, not a vertical wall.

How do you convert slope to an angle?

Take the inverse tangent: θ = arctan(m). A slope of 1 is 45°, a slope of 0.5 is about 26.57°, and a slope of 2 is about 63.43°. To go the other way, m = tan θ.

What is the slope of a vertical or horizontal line?

A horizontal line has a slope of 0 because the rise is 0. A vertical line has an undefined slope because the run is 0, and you can't divide by zero. Its equation is x = c rather than y = mx + b.

How do slopes of parallel and perpendicular lines compare?

Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line perpendicular to one with slope 2 has slope −1/2. The calculator lists the perpendicular slope for every non-horizontal line.

Sources

  1. 4.4 Understand Slope of a Line — Elementary Algebra 2e — OpenStax, Rice University. Checked October 10, 2026.
  2. 4.5 Use the Slope-Intercept Form of an Equation of a Line — Elementary Algebra 2e — OpenStax, Rice University. Checked October 10, 2026.
  3. 2010 ADA Standards for Accessible Design, 405.2 Slope — U.S. Access Board. Checked October 10, 2026.