Education & Research Tools

Slope Calculator

Find the slope of a line through two points, the equation in slope-intercept and point-slope form, and the same gradient as rise over run, percent grade and angle - useful for maths homework, ramps, roads and roofs.

  • Slope, grade and angle
  • Line equations
  • Plotted line
Runs in your browser

Everything you paste, type or drop is processed in this browser tab. It is not uploaded, logged, stored or sent to analytics.

Slope workspace

1 What do you have?

Try it:
Input

Decimals, negatives and fractions such as 3/4 are fine.

2 Slope

Enter two points, or a rise and a run, to see the slope, grade, angle and equation.

What the Slope Calculator does

This slope calculator finds the slope of the line through two points and gives the equation of that line in slope-intercept, point-slope and standard form, with the intercepts, the midpoint and the distance between the points. It also expresses the same gradient the way builders and road engineers do - as rise over run, a percent grade, an angle in degrees and a ratio such as 1 : 12 - and converts between them.

Fractions and decimals are handled exactly, so the points (1, 2) and (4, 6.5) give a slope of 3/2 and the line y = (3/2)x + 1/2 rather than a rounded decimal. For ramps it compares the result with the 1:12 maximum running slope in the US ADA Standards, as a reference point. Everything is calculated in your browser.

How to use it

  1. Choose your input: two points on a line, a rise and a run (for a ramp, path, roof or pipe), or a grade or angle you want converted.
  2. For two points, type x₁, y₁, x₂ and y₂. Negative numbers, decimals and fractions such as 3/4 are all accepted.
  3. For rise and run, measure both in the same unit: the vertical height gained and the horizontal distance it is gained over.
  4. Read the slope at the top, the grade, angle and ratio underneath, the equations of the line and a quick plot. The steps show the subtraction and division so you can copy the method into homework.

Reading the results

A positive slope rises from left to right, a negative one falls, zero is a horizontal line and an undefined slope is a vertical line, which has the equation x = constant.

Percent grade and angle are not the same number: a 100% grade is 45 degrees, not 90, because 100% means the rise equals the run. Road signs, railways and ramps use percent or ratio; roofs in the US use rise per 12 inches of run; maths uses the plain slope m.

The ramp check only compares the steepness with 1:12. Accessibility codes also set limits on rise per run, landings, width, handrails and cross slope, and local regulations vary.

Worked example: a line through two points and a wheelchair ramp

Points (1, 2) and (4, 6.5): the rise is 6.5 - 2 = 4.5 and the run is 4 - 1 = 3, so m = 4.5 / 3 = 3/2. The intercept is b = 2 - (3/2)(1) = 1/2, so y = (3/2)x + 1/2. Multiplying through by 2 gives the standard form 3x - 2y = -1.

The same slope is a grade of 150% and an angle of arctan(1.5) = 56.31 degrees. The distance between the points is √(3² + 4.5²) = 5.41.

A ramp rising 24 inches over a run of 288 inches has a slope of 24 / 288 = 1/12: a grade of 8.33% and an angle of 4.76 degrees. That is exactly the 1:12 maximum, so the calculator marks it as not steeper than the reference.

Formulas and scoring rules

Slope
m = (y₂ − y₁) / (x₂ − x₁) = rise / runUndefined when x₂ = x₁ (a vertical line).
Slope-intercept form
y = mx + b, b = y₁ − m·x₁
Point-slope form
y − y₁ = m(x − x₁)
Standard form
Ax + By = C, A = y₂ − y₁, B = x₁ − x₂, C = A·x₁ + B·y₁Scaled to whole numbers with no common factor and A positive.
Grade, angle and ratio
grade % = 100·m; angle = arctan(m); ratio = 1 : (1/m)Fractions are exact; decimals are rounded to 4 places (2 for percent and degrees) only for display.
Distance and midpoint
d = √((x₂ − x₁)² + (y₂ − y₁)²); M = ((x₁ + x₂)/2, (y₁ + y₂)/2)

The 1:12 ramp rule as a reference

Section 405.2 of the 2010 ADA Standards for Accessible Design limits the running slope of a ramp to 1:12 - one unit of rise for every twelve units of run, or 8.33% - and section 405.3 limits the cross slope to 1:48. Many national codes elsewhere use the same or similar figures, and some allow steeper slopes over short rises or require gentler ones.

The calculator shows how your gradient compares with 1:12 because it is the number most people are looking for when they measure a ramp. It is not a compliance check: treat it as a quick sense-check and confirm the design against the code that applies where you are, with a qualified professional where it matters.

Limitations: what the result does not prove

  • It describes straight lines and constant gradients. A path or road whose steepness changes needs measuring section by section.
  • Angles are measured from the horizontal in degrees. Some trades measure slope from the vertical or quote roof pitch as rise in inches per 12 inches of run; convert those before entering them.
  • The ramp comparison is one dimension of accessibility. It says nothing about landings, length of run between landings, width, handrails, surfaces or local law.
  • Very long decimals (more than 30 digits) are refused rather than rounded silently.

Privacy: where your data goes

Everything you paste, type or drop is processed in this browser tab. It is not uploaded, logged, stored or sent to analytics. Session recording and tag-manager scripts are switched off on this page.

Standards and sources

Frequently asked questions

How do you find the slope between two points?

Subtract the y-values and divide by the difference of the x-values in the same order: m = (y₂ − y₁) / (x₂ − x₁). For (1, 2) and (4, 6.5) that is 4.5 / 3 = 1.5. The calculator shows the subtraction and division step by step.

How do I convert slope to percent grade?

Multiply the slope by 100. A slope of 0.05, a rise of 5 over a run of 100, is a 5% grade. Percent grade is not an angle: 5% is about 2.86 degrees and 100% is 45 degrees.

What is the slope of a 1:12 ramp in percent and degrees?

A 1:12 ramp rises one unit for every twelve of horizontal run, which is 8.33% or about 4.76 degrees. That is the maximum running slope for ramps in the US ADA Standards.

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

Find the slope m, then the intercept b = y₁ − m·x₁, and write y = mx + b. The calculator gives that form, the point-slope form y − y₁ = m(x − x₁) and the standard form Ax + By = C with whole numbers.

What does an undefined slope mean?

The two points have the same x-value, so the line is vertical and the run is zero. You cannot divide by zero, so the slope has no value; the equation of the line is simply x = that value.

How do I convert a slope angle in degrees to a ratio?

Take the tangent of the angle to get the slope, then divide 1 by it for the 1 : n ratio. Ten degrees has a tangent of 0.1763, which is about 1 : 5.67, or a 17.63% grade. Choose the grade conversion mode to do it instantly.

Last reviewed by the A2Z.Tools team against the sources listed above.

Rate this tool

Was this tool useful? Your feedback helps us improve it.

No ratings yet — be the first to rate this tool.
Your rating (required)
0 / 2000

Please do not include passwords, payment details or other sensitive information.

Your feedback is sent privately to the A2Z.Tools team and will not be posted publicly.

Advertisement