Last updated:

Maths calculator

Slope Calculator

Enter two coordinate points and get slope, angle, distance, y-intercept, and the full line equation with a live graph. The same rise-over-run formula works for coordinate geometry, roof pitch, ramp grade, driveway slope, pipe drainage, and any other situation where you need to measure how much something rises or falls over a horizontal distance.

m = (y2 - y1) ÷ (x2 - x1)

Coordinate geometry

Enter two points

P1 P2 run rise
Formula: slope = rise ÷ run = (y2 - y1) ÷ (x2 - x1)

On This Page

What Is Slope?

Definition: Slope measures how much a line rises or falls for each unit of horizontal change.

A positive slope rises from left to right. A negative slope falls from left to right. A slope of zero is horizontal, and a vertical line has an undefined slope because its run is zero.

In plain language, slope answers this question: “For every 1 unit I move sideways, how much does the line move up or down?” That is why slope is often described as rise over run.

Slope From Two Points

The main slope formula from two points is:

m = (y2 - y1) ÷ (x2 - x1)
Slope diagram on a coordinate plane showing two points P₁ and P₂ with rise (Δy) and run (Δx) labeled, illustrating m = rise ÷ run

Enter both coordinate pairs exactly as they appear in the problem. The order of the points does not change the slope, reversing P1 and P2 flips the sign of both rise and run, and the negatives cancel. What does matter is using the same point order in both numerator and denominator: if you use y2 − y1 on top, use x2 − x1 on the bottom. Switching halfway gives the wrong sign. If the x-values are equal, run = 0, and the slope is undefined, the line is vertical.

When reading slope from a graph, use the coordinate values, not the visual steepness, a stretched or compressed axis makes a shallow line look steep. The calculator already returns the straight-line distance between your two points alongside the slope, if 2D, 3D, or latitude-longitude distance is the primary goal, the Distance Calculator offers those additional modes from the same coordinate inputs.

Slope-Intercept Form and Y-Intercept

After finding slope from two points, the calculator writes the line in slope-intercept form:

y = mx + b

Here m is the slope and b is the y-intercept, where the line crosses the y-axis. The calculator substitutes one of your entered points into y = mx + b and solves for b automatically.

If the line is vertical (both x-values are the same), slope-intercept form does not apply and the equation is written as x = constant instead.

Point-Slope Form

Point-slope form describes a line using a known point and the slope. It is useful when you already know the slope and one point, but do not yet know the y-intercept.

y − y1 = m(x − x1)

Where (x1, y1) is any known point on the line and m is the slope. To convert point-slope form to slope-intercept form, expand the right side and solve for y.

Point-Slope Form Example

Problem: A line has slope 3 and passes through (2, 5). Write the equation in point-slope form, then convert to slope-intercept form.

  1. Point-slope form: y − 5 = 3(x − 2)
  2. Expand: y − 5 = 3x − 6
  3. Solve for y: y = 3x − 1

Answer: Point-slope form is y − 5 = 3(x − 2). Slope-intercept form is y = 3x − 1.

To use this calculator for a point-slope problem: enter the known point as (x1, y1) and any second point, or enter two points on the line if both are given, and read the line equation from the result panel.

Standard Form to Slope-Intercept Form

Standard form is written as Ax + By = C. To convert to slope-intercept form, solve for y:

Ax + By = C  →  y = (−A/B)x + (C/B)

The slope is −A/B and the y-intercept is C/B.

Example: Convert 3x + 2y = 10 to slope-intercept form.

  1. Subtract 3x from both sides: 2y = −3x + 10
  2. Divide by 2: y = −1.5x + 5

Answer: Slope = −1.5, y-intercept = 5. To verify, pick any two points that satisfy the equation and enter them in the calculator above.

Percent Slope and Slope Angle in Degrees

Percent slope and slope angle are two ways to express the same steepness, they are just different formats of rise over run.

Percent slope = slope × 100
Angle (°) = arctan(slope)
Slope from angle = tan(angle)

For example: rise = 2, run = 10 → slope = 0.2 → percent slope = 20% → angle = arctan(0.2) ≈ 11.3°. The arctan function is the same one used to find angles in a right triangle, if you need the full set of sides, angles, and area for a right triangle rather than just the angle of a line, the Triangle Calculator solves those from any valid combination of three values.

Slope (decimal) Percent slope Angle (°) Common use
0.011%0.57°Minimum drain/gutter slope
0.022%1.15°Recommended driveway drainage
0.0838.3%4.76°ADA maximum ramp slope (1:12)
0.12512.5%7.13°Gentle roof pitch (1.5:12)
0.2525%14.04°Typical residential roof (3:12)
0.550%26.57°Steep roof (6:12)
1.0100%45°Equal rise and run

The angle and percent slope results appear automatically in the calculator's result panel when you enter two points.

Roof Slope

Roof slope in North America is expressed as a ratio of rise to 12 inches of horizontal run, called roof pitch. A 6:12 pitch means the roof rises 6 inches for every 12 inches of run, giving a slope of 6/12 = 0.5 (50%).

How to Calculate Roof Slope

To use this calculator for roof slope: enter (0, 0) as point 1 and (12, rise) as point 2, where rise is the vertical height in the same unit as the run. The slope result is the pitch expressed as a decimal; multiply by 12 to get the standard X:12 pitch notation.

Roof pitch = rise ÷ run  |  X:12 notation = slope × 12
Pitch (X:12) Slope Percent Angle
3:120.2525%14.0°
4:120.33333.3%18.4°
6:120.550%26.6°
8:120.66766.7%33.7°
12:121.0100%45.0°

How to calculate roof slope in degrees: use the angle result from this calculator, or apply arctan(rise/run) directly. A 6:12 pitch converts to arctan(0.5) ≈ 26.57°.

Ramp Slope, ADA and Wheelchair Ramps

Ramp slope is rise divided by horizontal run. In the US, ADA guidelines require a maximum ramp slope of 1:12 (1 inch of rise per 12 inches of run), which equals a slope of 0.0833 or 8.33%.

ADA maximum: slope ≤ 1/12 ≈ 0.0833 (8.33%)

To calculate ramp slope: enter the rise (vertical height) and run (horizontal length) in matching units. The slope result is the gradient; percent slope is that number times 100.

Example: A ramp rises 6 inches over 72 inches of horizontal run. Slope = 6/72 = 0.0833. Percent slope = 8.33%. This meets the ADA 1:12 maximum exactly.

Note: ADA and local building codes specify additional requirements beyond slope, including landing dimensions, handrail heights, and surface texture. Use this calculator for the math check only; always verify against the applicable code for your project.

Driveway, Pipe, Gutter, and Grading Slope

The same slope formula applies across every practical application. Enter horizontal run and vertical rise to get the gradient; multiply by 100 for percent slope.

Driveway Slope

Typical residential driveway slope is 1–5%. Less than 1% risks pooling water at the garage; more than 15% is generally considered too steep for safe vehicle access in wet conditions. To calculate: enter 0 and your horizontal driveway length as x-values, and 0 and the height change as y-values.

Pipe and drain slope

Drain pipes and sewer lines need enough slope to maintain self-cleaning flow velocity. A common rule of thumb for 4-inch pipe is a minimum slope of 1/8 inch per foot (about 1%). For 4-inch pipe the standard is 1/4 inch per foot (about 2%). Enter pipe length as run and vertical drop as rise, the slope result times 100 gives the percent grade.

Gutter slope

Gutters typically drain at 1/4 to 1/2 inch of drop per 10 feet of run (0.2–0.4%). Too little slope causes standing water and overflow; too much makes the gutter visually uneven. Use horizontal gutter length as run and intended drop as rise.

Grading and Grade Slope

Site grading slopes are specified as percentages. A common minimum for landscaped areas is 2% away from a building foundation. Steeper grades (5–10%) are used for berms and swales. Use horizontal distance as run and height change as rise, then multiply slope by 100 for the grade percentage.

How to Calculate Slope in Excel

In Excel or Google Sheets, use the built-in SLOPE function when you have y-values and x-values in ranges.

=SLOPE(known_y_values, known_x_values)

For only two points, you can also use the same formula as this calculator. If x1 is in A1, y1 is in B1, x2 is in A2, and y2 is in B2, use:

=(B2-B1)/(A2-A1)

Worked Examples

Example 1: Find Slope From Two Points

Problem: A line passes through (1, 2) and (7, 6). Find the slope, rise, and run.

  1. Rise = 6 - 2 = 4.
  2. Run = 7 - 1 = 6.
  3. Slope = 4 ÷ 6 = 0.6667.

Answer: The slope is about 0.6667.

Example 2: Negative Slope

Problem: A line passes through (-2, 8) and (4, 2). Find the slope.

  1. Rise = 2 - 8 = -6.
  2. Run = 4 - (-2) = 6.
  3. Slope = -6 ÷ 6 = -1.

Answer: The slope is -1, so the line falls from left to right.

Example 3: Slope-Intercept Form

Problem: A line passes through (2, 5) and (6, 13). Find the slope and equation in slope-intercept form.

  1. Rise = 13 - 5 = 8.
  2. Run = 6 - 2 = 4.
  3. Slope = 8 / 4 = 2.
  4. Use y = mx + b with point (2, 5): 5 = 2(2) + b.
  5. b = 1, so the equation is y = 2x + 1.

Answer: The slope is 2, and the line equation is y = 2x + 1.

Example 4: Vertical Line

Problem: Find the slope through (3, 1) and (3, 9).

  1. Rise = 9 - 1 = 8.
  2. Run = 3 - 3 = 0.
  3. Division by zero is undefined.

Answer: The line is vertical, so the slope is undefined.

Example 5: Percent Slope for a Ramp

Problem: A ramp rises 1.5 ft over a horizontal run of 12 ft. Find the slope and percent slope.

  1. Slope = rise / run = 1.5 / 12 = 0.125.
  2. Percent slope = 0.125 × 100 = 12.5%.

Answer: The ramp has a 0.125 slope, or 12.5% slope.

Frequently Asked Questions

How do you calculate slope from two points?

m = (y2 − y1) ÷ (x2 − x1). Subtract y-coordinates for rise, subtract x-coordinates for run, divide. Points (1, 2) and (7, 6): rise = 4, run = 6, slope = 4/6 ≈ 0.667. If the line is given in slope-intercept form y = mx + b, the slope is the coefficient m directly, no calculation needed.

How do you calculate percent slope and grade?

Multiply decimal slope by 100: slope 0.08 = 8% grade. A road sign reading "8% grade" means the road rises (or falls) 8 meters for every 100 meters of horizontal distance. To convert percent back to decimal, divide by 100.

How do you calculate slope angle in degrees?

Angle = arctan(rise ÷ run). A slope of 0.5 gives arctan(0.5) ≈ 26.57°. The calculator returns this automatically in the result panel.

How do you calculate roof slope?

Rise divided by horizontal run. A roof rising 6 inches over 12 inches of run has slope = 0.5, written as 6:12 pitch. In degrees: arctan(0.5) ≈ 26.6°. To get X:12 notation from a decimal slope, multiply slope × 12.

How do you calculate ramp slope?

Rise divided by horizontal run. ADA guidelines cap wheelchair ramp slope at 1:12 (8.33%). For a ramp that rises 6 inches over 72 inches: slope = 6/72 = 0.0833, or 8.33%. Always verify against local building codes, ADA specifies additional requirements beyond the slope ratio, including landing dimensions and handrail height.

How do you calculate slope in Excel?

Use =SLOPE(known_y_values, known_x_values) for a range of data points. For just two points with x-values in column A and y-values in column B: =(B2−B1)/(A2−A1). For the y-intercept: =INTERCEPT(known_y_values, known_x_values).

What does undefined slope mean, and how is it different from zero slope?

A vertical line has undefined slope because both x-values are equal, making the run zero, division by zero is undefined. A horizontal line has zero slope because the rise is zero while run is nonzero: 0 ÷ run = 0. Horizontal = zero slope; vertical = undefined slope.

References

Method

Author, Review, and Formula Method

Written by Calculators Labs Editorial Team
Reviewed by Calculators Labs
Last updated

The Slope Calculator uses m = (y₂ - y₁) / (x₂ - x₁). The calculator reads x₁, y₁, x₂, y₂, applies the formula, and shows the result with practical rounding so the answer is easy to check.

For calculators with units, measurements are kept in one unit system before the final result is displayed. The steps are written to help students, teachers, and everyday users see how the answer was produced.