Math

Slope calculator

Slope measures how steep a line is: the change in y divided by the change in x between two points, often called rise over run. This slope calculator takes two points and returns the slope, the line’s equation, its angle in degrees, the percent grade, the distance between the points and the midpoint.

Runs in your browser. Nothing you type is sent to us.

Slope (m)

2

y = 2x

Angle of the line
63.4349°
Grade
200%
Distance
6.708204
Midpoint
(2.5, 5)
y-intercept
0
x-intercept
0

Key facts

  • Slope m = (y₂ − y₁) ÷ (x₂ − x₁). Between (1, 2) and (4, 8), m = 6 ÷ 3 = 2.
  • Slope-intercept form: y = mx + b, where b is the y-intercept.
  • Angle = tan⁻¹(m), and percent grade = m × 100. A slope of 1 is a 45° angle and a 100% grade.
  • A horizontal line has slope 0; a vertical line has an undefined slope.

What is slope?

Slope (usually written m) tells you how much a line rises or falls for each unit you move to the right. A positive slope goes up from left to right, a negative slope goes down, a slope of zero is flat, and a vertical line has an undefined slope because its run is zero. The same idea appears as the pitch of a roof, the grade of a road, the gradient of a ramp and the rate of change in a graph.

How to use the slope calculator

Enter the coordinates of two points, (x₁, y₁) and (x₂, y₂). The calculator shows the slope as a decimal and fraction, the equation of the line, the angle with the x-axis, the grade as a percentage, the distance between the points, the midpoint and both intercepts.

Slope formulas

m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ runy = mx + b, with b = y₁ − m × x₁Angle θ = tan⁻¹(m)Grade = m × 100%Distance = √((x₂ − x₁)² + (y₂ − y₁)²)Midpoint = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
SymbolMeaning
mSlope
by-intercept, where the line crosses the y-axis
θAngle between the line and the horizontal
rise, runVertical change, horizontal change

Worked examples: slope

Example 1: two points

Points (1, 2) and (4, 8). Rise = 8 − 2 = 6, run = 4 − 1 = 3, so m = 2. Then b = 2 − 2 × 1 = 0, so the line is y = 2x. The angle is tan⁻¹(2) ≈ 63.43° and the distance between the points is √(9 + 36) ≈ 6.708.

Example 2: roof pitch

A roof rises 6 inches for every 12 inches of horizontal run, written 6/12. The slope is 0.5, a 50% grade and an angle of tan⁻¹(0.5) ≈ 26.57°.

Example 3: wheelchair ramp

Accessibility guidelines in the US limit ramps to a 1 : 12 slope. That is m = 1 ÷ 12 ≈ 0.0833, an 8.33% grade or 4.76°. A 30-inch rise needs at least 360 inches (30 ft) of ramp run.

Slope, grade and angle conversions

GradeSlope (rise : run)Angle
1%1 : 1000.57°
2%1 : 501.15°
5%1 : 202.86°
8.33%1 : 124.76°
10%1 : 105.71°
25%1 : 414.04°
50%1 : 226.57°
100%1 : 145°
173%1.73 : 160°

Grade and angle are not proportional. A 100% grade is 45°, not 90°; a vertical wall has an infinite grade.

Parallel and perpendicular lines

Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, so a line perpendicular to y = 2x has slope −1/2.

Mistakes to avoid with slope

  • Mixing the order of points. Subtract in the same order on top and bottom: (y₂ − y₁) with (x₂ − x₁).
  • Swapping rise and run. Slope is vertical change over horizontal change.
  • Treating grade as an angle. A 10% road is about 5.7°, not 10°.
  • Dividing by zero. If x₁ = x₂ the line is vertical and the slope is undefined.

Slope on roads, ramps and roofs

Slope as rise over run is how engineers, builders and accessibility codes describe steepness. The 2010 ADA Standards for Accessible Design, issued by the US Department of Justice under the Americans with Disabilities Act, limit wheelchair ramps to a slope of 1:12 (about 8.33%), with landings at least every 30 inches of rise. Highway designers follow guidance from AASHTO, the American Association of State Highway and Transportation Officials, which limits grades on interstates to a few percent in most terrain. Roofers quote pitch as rise per 12 inches of run, so a "6/12" roof has a slope of 0.5.

Steep real-world slopes make the numbers vivid: Baldwin Street in Dunedin, New Zealand, long listed by Guinness World Records as the steepest residential street, has a maximum grade of about 35%. In mathematics, slope is the rate of change of a linear function, introduced with coordinate geometry by René Descartes and Pierre de Fermat, and its limit for curves became the derivative of calculus. Why the letter m is used for slope is uncertain; the claim that it comes from French *monter* has no clear evidence. In US schools, Common Core standard 8.EE.B.5 introduces slope as a unit rate. The slope of a line also equals the tangent of its angle with the x-axis, and linear interpolation uses the same slope to estimate values between two known points. For the full line equation, use the slope-intercept form calculator; for the distance between the points, the distance formula calculator; and for the angle of a slope, the inverse trig calculator.

How this calculator works

  • Slope m = (y₂ − y₁) ÷ (x₂ − x₁), shown as a decimal and an exact fraction.
  • Angle of inclination = arctan(m) in degrees; grade = m × 100%.
  • Also shows the distance between the points, the midpoint, and the x- and y-intercepts of the line through them.
  • Equal x values give a vertical line with undefined slope (x = c).

Frequently asked questions

How do I find the slope of a line?

Pick two points on the line, subtract the y-values and the x-values in the same order, and divide: m = (y₂ − y₁) ÷ (x₂ − x₁).

What is the slope between (2, 3) and (6, 11)?

m = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2.

How do I convert slope to degrees?

Take the inverse tangent of the slope: θ = tan⁻¹(m). A slope of 0.25 is about 14.04°.

How do I convert slope to a percentage?

Multiply the slope by 100. A slope of 0.06 is a 6% grade, meaning 6 units of rise per 100 units of run.

What does a negative slope mean?

The line goes down as you move to the right: y decreases when x increases.

What is the slope of a horizontal line?

Zero, because the rise is zero. A vertical line has an undefined slope because the run is zero.

How do I write the equation of a line from two points?

Find the slope m, then find b = y₁ − m × x₁. The equation is y = mx + b.

What is a 4/12 roof pitch in degrees?

A 4/12 pitch has slope 0.333, about 18.43° and a 33.3% grade.

Sources

  1. OpenStax, College Algebra 2e (linear functions)
  2. U.S. Access Board, ADA Standards: Ramps

Updated November 25, 2026. Formulas checked against published sources and worked examples.

Cite this page: CalcRoster. "Slope calculator." calcroster.com/slope-calculator/. Updated November 25, 2026.

Results are estimates for general information. They are not financial, medical or legal advice. Check important decisions with a qualified professional.