MathsGeometry

Slope
calculator.

Two points, or a rise and a run, give a line's steepness, equation, grade and angle.

How it's worked out

Slope is the ratio of the rise to the run: how far a line goes up for each step across. With two points, the rise is the change in y and the run is the change in x. You can call either point the first one, as long as you subtract in the same order on the top and the bottom.

m\displaystyle m=y2−y1x2−x1\displaystyle {}= \frac{y_2 - y_1}{x_2 - x_1}

A positive slope climbs to the right, and a negative one falls. A horizontal line has a slope of 0. A vertical line has a run of 0, and since nothing can be divided by 0, its slope is not defined.

The slope-intercept form writes the same line using b, the point where it crosses the y-axis. Point-slope and standard form describe the identical line in other ways.

y\displaystyle y=mx+b\displaystyle {}= mx + b

Builders write the same number differently. A percent grade multiplies the ratio by 100, so 1:12 is about 8.33%. The angle from level is the one whose tangent equals the slope.

grade\displaystyle \text{grade}=riserun×100%\displaystyle {}= \frac{\text{rise}}{\text{run}} \times 100\%
angle\displaystyle \text{angle}=arctan⁡riserun\displaystyle {}= \arctan \frac{\text{rise}}{\text{run}}

Worked examples

Aisha finds a line through two points

Aisha has (−2, 1) and (4, 5). The rise is 4 and the run is 6, which reduces to a slope of 23\frac{2}{3}. Put one point into the equation, and b comes to 73\frac{7}{3}.

y\displaystyle y=23x+73\displaystyle {}= \frac{2}{3}x + \frac{7}{3}

In standard form that is 2x − 3y = −7. The line sits 33.69° above level, and a line square to it has a slope of −32-\frac{3}{2}. To check, put in x = 4, and the equation gives 5, her second point.

Open this example in the tool

Ben checks how long a 24 inch ramp must run

Ben has a 24 in step up to a porch. The ADA limit of 1:12 is a 8.33% grade, or 4.76° from level. At that slope, a 24 in rise takes a run of 288 in, which is 24 ft, and the sloped deck itself is 289 in long. The rise is under the 30 in limit for one run, so it needs no landing partway up.

Open this example in the tool

Nora reads a shop's sales trend as a slope

A shop sold $41,000 in 2019 and $58,500 in 2024. The slope between those points is $3,500 per year. It is the average climb across five years, not a claim that each year rose by that much.

Open this example in the tool

Reading your result

Fractions first. With whole numbers or short decimals, the slope reads as a reduced fraction, because that is the exact answer. The decimal next to it is rounded. A line through (2, 3) with a slope of −4 is y = −4x + 11.

Grade and angle do not move in step. Grade is a tangent, not an angle. A 100% grade is 45°, not 90°, and a true wall has no finite grade. A 6% road is only 3.43°.

Common grades, with the angle and the ratio
GradeAngleRatio
1%0.57°1:100
2%1.15°1:50
5%2.86°1:20
8.33%4.76°1:12
10%5.71°1:10
25%14.04°1:4
50%26.57°1:2
100%45°1:1

Ramp limits. The Access Board guide to the ADA Standards sets a ramp's running slope at 1:12 at most, with no more than 30 in of rise per run and a cross slope of 1:48 at most. A walking surface steeper than 1:20 counts as a ramp. The guide also recommends the least slope you can manage, since a gentler ramp is easier to use. Local codes may ask for more, so check yours before you build.

Straight lines only. Here, one slope holds along the whole line. For the slope of a curve at one point, use the tangent line calculator.

Common mistakes

  • Mixing the order of the points. Taking y₂ − y₁ on top and x₁ − x₂ below flips the sign, which turns a climb into a fall. Keep the same point first in both.
  • Calling a vertical line zero slope. Zero on top means a flat line with slope 0. Zero on the bottom means a vertical line, whose slope is undefined.
  • Measuring a ramp along its surface. Run is measured level, across the ground. Using the sloped length as the run makes the slope look gentler than it is.
  • Treating percent as degrees. A 45° roof is a 100% grade. A 45% grade is only 24.23°, so reading it as 45° nearly doubles the true steepness in your head.

Questions people ask

Yes. A 100% grade means the rise equals the run, and a right triangle with equal legs has a 45 degree corner. To go from grade to angle, take the inverse tangent of the grade over 100.

Sources