Slope Calculator

Slope Calculator: Two Points, Rise and Run, Grade and Pitch

Two points on a worksheet, a rise and run on a ramp plan or a 6/12 roof: this slope calculator turns any of them into an exact slope, the equation of the line, the angle, the percent grade and a 1:N ratio, with the working shown.

Point 1
Point 2

Fractions and decimal commas work: 3/4, -1 1/2, 1,5.

Type two points, or pick an example.

What the slope calculator gives you, in class or on site

I explain slope the same way on graph paper and on a ramp plan: rise over run, the same point first every time, and the run measured level. The slope calculator above works on that rule. For homework, give it two points or a point and a slope: you get m as an exact fraction and a decimal, the angle, percent grade, distance, midpoint, all three equations of the line and a graph with the rise/run triangle, drawn with the same scale on both axes, and the step-by-step working under the results. Fractions like −1 1/2 and a decimal comma like 1,5 are read as you meant them, and anything it cannot read gets an error message on that field instead of a quiet guess.

The School and Build switch is for the job. Build adds a choice of units (inches, feet, centimetres, metres), an x/12 roof pitch field with pitch factor and rafter length, and a fourth tab, Ramp check, that checks a rise against the 1:12 rule, counts runs and landings and draws a side view to scale. The Rise, run, grade tab solves from the two fields you typed last, fills in the others and tints them, and never overwrites what you typed; a grade, angle, ratio or pitch on its own gives the slope without inventing a rise or a run. Copy as text and a share link sit under the results.

Slope of a line from two points

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

Choose which point is first and keep it first on top and on the bottom. If you write (y₂ − y₁) ÷ (x₁ − x₂) you get the right size and the wrong sign, and that is the error I mark most often. Worked example with (−2, 3) and (4, −1):

  1. Δy = −1 − 3 = −4
  2. Δx = 4 − (−2) = 6
  3. m = −4 ÷ 6 = −2/3 ≈ −0.6667
  4. Angle = arctan(−2/3) ≈ −33.69°, grade ≈ −66.67 %
  5. Distance = √(6² + (−4)²) = √52 ≈ 7.2111

A negative slope falls as you read left to right; a positive one climbs. Zero and undefined are different answers. A horizontal line has Δy = 0, so m = 0 and its equation is y = b. A vertical line has Δx = 0, you cannot divide by zero, so its slope is undefined and its equation is x = a. The calculator says “undefined” for a vertical line instead of passing off a huge number as a slope, and its angle dial reads “vertical, slope undefined” with the needle at 90°.

Equation of the line in three forms

Once you have m, point-slope form is the fastest because you write it straight down: y − y₁ = m(x − x₁). With m = −2/3 through (−2, 3) that is y − 3 = −2/3(x + 2).

Solve for y to get slope-intercept form. Here b = y₁ − m·x₁ = 3 − (−2/3)(−2) = 3 − 4/3 = 5/3, so y = −2/3x + 5/3. For standard form Ax + By = C, multiply through by 3 and move the x term across: 2x + 3y = 5. I always ask for whole-number coefficients with A positive and no common factor, because that is how teachers mark it and it makes two answers easy to compare. The tool reduces the same way, so the line through (0.2, 0) and (1.2, 0.5) comes out as 5x − 10y = 1, not 0.5x − y = 0.1. It prints a decimal when the decimal ends (y = 0.75x + 0.25) and a fraction when it does not (y = −2/3x + 5/3), writes a horizontal line as y = 3 in all three forms and never prints “1x”.

Parallel and perpendicular lines. Parallel lines share the slope. A perpendicular line takes the negative reciprocal: flip the fraction and change the sign, so −2/3 becomes 3/2 and m₁ · m₂ = −1. Forgetting the sign change is the classic slip. The product rule does not cover horizontal and vertical lines, which are perpendicular to each other: anything perpendicular to y = 3 has the form x = a. In the tool, the Two points and Point + slope tabs draw a parallel and a perpendicular line through any point you choose. The default is the midpoint, which gives the perpendicular bisector, and buttons set the point to Point 1 or the origin. The guide to the equation of a line from two points works three full examples, including the perpendicular bisector through the midpoint.

Percent grade, degrees, 1:N ratio and roof pitch

These four scales describe the same steepness, and confusing them is how a ramp ends up too steep. Percent grade is 100 × rise ÷ run, with the run measured horizontally. Degrees are arctan(rise ÷ run). A 1:N ratio, or “1 in N”, has N = run ÷ rise. Roof pitch is the rise in 12 units of run, written x/12. They do not scale together: 100 % grade is 45°, not a vertical wall, and 1:12 is 8.33 %, not 12 %.

Right triangle with a horizontal run of 5 and a rise of 2, showing slope 0.4, grade 40 percent, angle 21.80 degrees, 1 in 2.5 and pitch 4.8/12
One triangle, five ways to write its slope. The run is always the level leg, never the sloped edge.

In Build mode the tool does not call a slope gentle or extreme. It sets your slope against the limits that exist, the 1:48 cross slope, the 1:12 ramp, the 1:10 and 1:8 existing-site ramps, and says whether the slope is within each or steeper, and whether a roof pitch is a low-slope roof (4/12 or less) or a steep roof.

Slope conversion table (rounded)
Percent gradeDegreesRatioRoof pitchWhere you meet it
2.08 %1.19°1:480.25/12ADA maximum cross slope; ¼ in per ft fall
5 %2.86°1:200.6/12gentle path or driveway
8.33 %4.76°1:121/12ADA maximum running slope for a ramp
10 %5.71°1:101.2/12ADA, existing sites, rise up to 6 in
12.5 %7.13°1:81.5/12ADA, existing sites, rise up to 3 in
25 %14.04°1:43/12low-slope roof (OSHA)
33.33 %18.43°1:34/12steepest pitch OSHA still calls low-slope
50 %26.57°1:26/12steep roof (OSHA)
57.74 %30°1:1.7326.93/12a 30° line
100 %45°1:112/12rise equals run

Slope on the job: driveways, patios, roofs and ramps

Driveway. The garage floor sits 3.5 ft above the street over 40 ft of horizontal run. m = 3.5 ÷ 40 = 0.0875, so the grade is 8.75 %, arctan(0.0875) ≈ 5.00°, and the ratio is 1 in 40 ÷ 3.5 ≈ 11.43. Take the run off the plan or along a level line; a tape laid down the slope gives the longer sloped length and a gentler-looking grade.

Patio fall. A quarter inch per foot is 0.25 ÷ 12 ≈ 0.0208, which is 2.08 %, about 1.19°, or 1:48. Over a 10 ft patio that comes to 10 × 0.25 = 2.5 in of fall. I set falls in inches per foot or as a ratio and never trust a level reading in degrees when the plan says percent. At these small angles a tenth of a degree is a big share of the fall.

Roof. A 6/12 roof rises 6 in for every 12 in of run: m = 0.5, which is 26.57° and 50 %. The pitch factor is √(1 + 0.5²) ≈ 1.118034. With a 12 ft horizontal run the rise is 6 ft and the rafter line length is 12 × 1.118034 ≈ 13.42 ft, about 13 ft 5 in, before you add the overhang or take off for the ridge board. OSHA treats roofs up to 4 in 12 as low-slope and anything steeper as a steep roof. The roof pitch to degrees guide has the full chart from 1/12 to 12/12 and shows how to measure pitch with a level and a tape.

Wheelchair ramp. The U.S. Access Board guide to the ADA standards sets a maximum running slope of 1:12 and a maximum rise of 30 in for each run. Intermediate landings must be at least 60 in long (60 × 60 in where the ramp turns), ramps rising more than 6 in need handrails on both sides at 34–38 in, the clear width must be at least 36 in and the cross slope no more than 1:48. For a 24 in rise you need 24 × 12 = 288 in, or 24 ft, of run in a single run, plus handrails. A 36 in rise needs 432 in of run, which has to be split into two runs of 18 in rise and 216 in each with a landing between them: 216 + 60 + 216 = 492 in, or 41 ft, in a straight line before the top and bottom landings. Where space is tight on an existing site, the guide allows 1:10 for a rise up to 6 in and 1:8 for a rise up to 3 in. The Ramp check tab does this arithmetic for a rise in inches, feet, centimetres or metres (30 in is taken as 762 mm and 60 in as 1524 mm): it returns the minimum run, the runs, the landings, the straight length without end landings and whether handrails are needed, and it tells you if a run you planned is too steep, so a 24 in rise with a planned 240 in run fails and needs 288 in. The 1:10 and 1:8 options are refused for a bigger rise than the guide allows. Plan a level landing at the top and bottom as well. This is general information, not legal advice; your local code official has the final say. The 1:12 ramp guide lays out runs and landings step by step.

Side view of a ramp rising 36 inches at 1:12: two runs of 216 inches, each rising 18 inches, with a 60-inch landing between them, 492 inches in total
The 30 in limit per run is what adds length: the landing between runs counts too.

Mistakes I correct most often

Where every number comes from

The formulas are the textbook ones: m = Δy ÷ Δx, angle θ = arctan m between −90° and 90°, grade = 100 × m, N = |run ÷ rise|, distance d = √(Δx² + Δy²), intercept b = y₁ − m·x₁, pitch factor √(1 + m²), and for ramps minimum run = rise × 12 with the number of runs equal to the rise divided by 30 in, rounded up. A fraction appears only when it is exact: the tool takes the numbers you typed, turns decimals into whole numbers by powers of ten and cancels the common factor. A slope that comes from an angle, such as tan 30° ≈ 0.57735, stays a decimal, because no fraction equals it. Rounding happens only on display: angles and percentages to four decimals, the ratio N to three, the slope and School-mode lengths to six. Unit conversion is exact (1 in = 25.4 mm). Nothing you type leaves your browser, and the page remembers only your mode and unit.

The definitions follow OpenStax College Algebra 2e, section 4.1, the ramp rules follow the U.S. Access Board guide, chapter 4, and the low-slope roof line follows OSHA 1926.500. These control cases are worked out independently and checked against the tool:

InputExpected result
(1, 1) → (3, 5)m = 2, 63.4349°, 200 %, d = 4.472136, y = 2x − 1, 2x − y = 1, perpendicular bisector y = −0.5x + 4
(−2, 3) → (4, −1)m = −2/3, −33.6901°, d = 7.211103, y = −2/3x + 5/3, 2x + 3y = 5, x-intercept (2.5, 0)
(−3, −2) → (5, 4)m = 3/4, 36.8699°, 75 %, d = 10, y = 0.75x + 0.25, 3x − 4y = −1
(0, 3) → (5, 3)m = 0, y = 3 in all three forms, no x-intercept
(2, 0) → (2, 7)slope undefined, x = 2, d = 7, dial reads vertical
(0.2, 0) → (1.2, 0.5)m = 1/2, 5x − 10y = 1
From (0, 0) to x₂ = “1,5”, y₂ = 3m = 2 (the comma is read as a decimal point)
Rise 1 and run 12m = 1/12, 8.3333 %, 4.7636°, 1 in 12
Rise 0.5 and grade 8 %run 6.25, 4.5739°
Grade 10 %, then angle 30°57.735 %, 1 in 1.732, m = 0.57735 with no fraction
Point (2, 3), m = −1/2, d = 4A (5.577709, 1.211146), B (−1.577709, 4.788854)
Pitch 6/12, run 12 ft26.5651°, 50 %, rise 6 ft, factor 1.118034, rafter 13.4164 ft (13 ft 5 in)
Ramp rise 36 in at 1:12432 in of run in 2 runs of 18 in rise over 216 in, 1 landing, 492 in straight length, handrails
Ramp rise 24 in, planned run 240 infails 1:12: needs at least 288 in of run

Guides

  1. Roof pitch to degrees: 4/12, 6/12 and 12/12 explained6/12 is 26.57 degrees, not 30. Pitch chart 1/12 to 12/12, pitch factor, rafter length from the run and how to measure a roof safely.6-minute read
  2. Wheelchair ramp slope: the 1:12 rule, runs and landings1:12 is 8.33 %, not 12. Run length for any rise, the 30 inch limit, landings and a worked 36 inch layout, from the U.S. Access Board guide.6-minute read
  3. Equation of a line from two points: three forms, step by stepSlope, intercept and three forms for (1, 1) to (3, 5) and (−2, 3) to (4, −1), with vertical lines, perpendicular lines and the bisector.7-minute read

Things people ask

How do you find the slope from two points?

Subtract the y values and the x values in the same order and divide: m = (y₂ − y₁) ÷ (x₂ − x₁). For (−2, 3) and (4, −1) that is −4 ÷ 6 = −2/3.

What is the slope of a vertical line?

It is undefined, because the run Δx is zero and you cannot divide by zero; the equation is x = a. A horizontal line has slope 0 and equation y = b.

Is 100 % grade a vertical wall?

No. 100 % means the rise equals the run, which is 45°. A vertical line has no percent grade at all, because its run is zero.

What is a 6/12 roof pitch in degrees?

A 6/12 pitch is a slope of 0.5, so arctan(0.5) ≈ 26.57°, or 50 %. Its pitch factor is about 1.118, so 12 ft of run needs about 13.42 ft of rafter before overhang.

What is the maximum slope for a wheelchair ramp?

Under the ADA standards it is 1:12, which is 8.33 % or about 4.76°, with no more than 30 in of rise per run. This is general information; check with your local code official.

How do I find a perpendicular slope?

Take the negative reciprocal: flip the fraction and change the sign, so 2/3 becomes −3/2. A line perpendicular to a horizontal line is vertical, and the reverse.

Can I type fractions or a decimal comma?

Yes. The fields read 1.5, 1,5, 1.234,5, 3/4, −1 1/2 and a minus sign typed as −. Anything else gets an error message on that field, so a typo never turns into a wrong slope.

Updated · About this site