Slope Calculator

Find the slope of a line from two points or rise and run, plus the line equation, y-intercept, angle, percent grade, roof pitch, distance and midpoint.

Updated November 2026 · Free, no signup · Educational estimate, not professional advice

Slope calculator

This slope calculator finds the slope of a line from two points, or from rise and run, and gives you everything that goes with it: the slope as a decimal and a simplified fraction, the equation of the line in slope-intercept and point-slope form, the y-intercept and x-intercept, the angle in degrees, the percent grade, the distance between the points and the midpoint. Switch to rise and run to get roof pitch, ramp grade and an ADA ramp check.

How to use the slope calculator

  1. Two points: enter the coordinates (x₁, y₁) and (x₂, y₂). Negative numbers and decimals are fine.
  2. Rise and run: enter the vertical change and the horizontal distance in the same unit, for example inches, feet or meters.
  3. Press Calculate slope. The result shows the working, so you can follow every step.

The slope formula

Slope measures how steep a line is: how much it goes up or down (the rise) for each unit it goes across (the run). It is usually written as m.

You may also find our Volume Calculator and Percentage Calculator useful.

m = rise / run = (y₂ - y₁) / (x₂ - x₁)

Example: for the points (2, 3) and (6, 11), the rise is 11 - 3 = 8 and the run is 6 - 2 = 4, so m = 8 / 4 = 2. The line goes up 2 units for every 1 unit it moves to the right.

It does not matter which point you call the first, as long as you subtract in the same order on the top and bottom. Using (6, 11) first gives (3 - 11) / (2 - 6) = -8 / -4 = 2, the same answer.

The four types of slope

TypeValue of mWhat the line does
Positivem > 0Rises from left to right
Negativem < 0Falls from left to right
Zerom = 0Horizontal (y = constant)
Undefinedrun = 0Vertical (x = constant)

The larger the absolute value of m, the steeper the line. A slope of 5 is steeper than a slope of 0.5, and a slope of -4 is steeper than a slope of -1, though one goes up and the other goes down.

The rise and run of a slope are the two legs of a right triangle, so the Pythagorean Theorem Calculator gives the length of the sloped line itself, such as a ramp, roof rafter or ladder.

Equation of a line from slope

Once you know the slope, you can write the equation of the line. The calculator gives three forms.

Slope-intercept form

y = mx + b

Here b is the y-intercept, where the line crosses the y-axis. To find b, substitute one point into the equation: with m = 2 and the point (2, 3), 3 = 2(2) + b, so b = -1. The line is y = 2x - 1.

Point-slope form

y - y₁ = m(x - x₁)

This form is quickest when you have a point and a slope. For m = 2 through (2, 3): y - 3 = 2(x - 2). Expanding gives y = 2x - 1 again.

Standard form

Ax + By = C

Rearranging y = 2x - 1 gives 2x - y = 1. In standard form, the slope is -A / B, here -2 / -1 = 2.

Slope as an angle

Slope and angle are linked by the tangent function. The angle a line makes with the horizontal is:

angle = arctan(m)    m = tan(angle)

A slope of 1 is a 45 degree angle, a slope of 2 is about 63.43 degrees and a slope of 0.5 is about 26.57 degrees. Notice that doubling the slope does not double the angle. A vertical line is 90 degrees and has an undefined slope.

Percent slope and grade

Engineers, road builders and landscapers often express slope as a percentage, called the grade:

Percent grade = (rise / run) x 100

A road that climbs 6 feet over 100 feet of horizontal distance has a 6 percent grade. A 100 percent grade is a 45 degree angle, not a vertical wall. Percent grade is the same as slope times 100, so a slope of 0.08 is an 8 percent grade.

GradeSlopeAngleTypical use
1-2%0.01-0.020.6-1.1°Patios and drainage away from a house
2%0.021.15°Maximum cross slope of an accessible path
5%0.052.86°Walkway that is not legally a ramp
6-7%0.06-0.073.4-4°Steep section of an interstate highway
8.33%1:124.76°Maximum ADA ramp slope
15%0.158.53°Very steep residential driveway
100%145°Rise equals run

Roof slope and pitch

In the U.S., roof slope is usually written as pitch: inches of rise per 12 inches of run. A 6:12 roof rises 6 inches for every foot across, a slope of 0.5 and an angle of 26.57 degrees. Use the rise and run mode to convert any measurement to pitch.

PitchAnglePercentNotes
2:129.46°16.7%Low slope; special roofing needed
4:1218.43°33.3%Common minimum for standard shingles
6:1226.57°50%Common residential pitch
8:1233.69°66.7%Steep; harder to walk on
12:1245°100%Very steep

To measure pitch, place a level horizontally against the roof underside or rafter, mark 12 inches along the level and measure straight up to the roof surface. That vertical measurement is the rise per foot.

Wheelchair and ADA ramp slope

The 2010 ADA Standards for Accessible Design set a maximum running slope of 1:12 (8.33 percent) for ramps: 1 inch of rise for every 12 inches of run. A doorway 24 inches above the ground therefore needs at least 24 feet of ramp. Each ramp run may rise no more than 30 inches before a level landing. Gentler slopes such as 1:16 or 1:20 are easier for many users. The calculator flags any rise and run steeper than 1:12, but always check local code before building.

Parallel and perpendicular slopes

Parallel lines have the same slope. Perpendicular lines have slopes that are negative reciprocals of each other, so their product is -1. If a line has slope 2, any perpendicular line has slope -1/2. The calculator shows the perpendicular slope with every two-point result.

Distance and midpoint

The distance between two points comes from the Pythagorean theorem, and the midpoint is the average of the coordinates:

Distance = √((x₂ - x₁)² + (y₂ - y₁)²)
Midpoint = ((x₁ + x₂) / 2, (y₁ + y₂) / 2)

For (2, 3) and (6, 11): distance = √(16 + 64) = √80 ≈ 8.944, and the midpoint is (4, 7).

Slope in real life

  • Rates of change: on a distance-time graph, slope is speed. On a cost graph, slope is the price per unit.
  • Finance: the slope of a savings balance over time shows how fast it is growing. See the compound interest calculator for curved growth where the slope keeps increasing.
  • Construction: drainage pipes typically need about 1/4 inch of fall per foot (around 2 percent), and gutters about 1/4 inch per 10 feet.
  • Hiking and cycling: trail and road grades tell you how hard a climb will be.
  • Statistics: the slope of a regression line shows how much one variable changes when another goes up by one.

How to calculate slope in Excel

For two points, use =(D2-B2)/(C2-A2) with x₁, y₁, x₂, y₂ in A2 to D2. For a set of data points, =SLOPE(known_ys, known_xs) returns the slope of the least-squares best-fit line, and =INTERCEPT(known_ys, known_xs) returns its y-intercept. To convert slope to degrees, use =DEGREES(ATAN(m)).

Worked slope examples

PointsRise / runSlopeEquationAngle
(0, 0) and (4, 4)4 / 41y = x45°
(1, 5) and (3, 1)-4 / 2-2y = -2x + 7-63.43°
(-2, 1) and (4, 4)3 / 61/2y = 0.5x + 226.57°
(0, 3) and (5, 3)0 / 50y = 30°
(2, -1) and (2, 6)7 / 0Undefinedx = 290°

Notice the second row. The line falls 4 units while moving 2 units right, so its slope is negative, and the angle is measured below the x-axis. Enter any of these pairs above to see the full breakdown.

Slope in science and statistics

Many physics graphs are read through their slope. On a position-time graph the slope is velocity, on a velocity-time graph it is acceleration, and on a graph of force against stretch for a spring it is the spring constant. In economics, the slope of a cost line is the marginal cost of one more unit. In statistics, the slope of a regression line tells you the average change in y for each one-unit increase in x: a slope of 2.4 on a chart of test score against hours studied means each extra hour is associated with about 2.4 more points. When data points do not sit on a perfect line, use a best-fit slope such as Excel's SLOPE function rather than two hand-picked points.

Learn more

For a step-by-step lesson with graphs, tables, equations and practice problems, read how to find slope. Slope is a ratio of rise to run, so the ratio calculator is a useful companion, and the full list of tools is on the math calculators page.

About this calculator and your privacy

This calculator runs entirely in your web browser. The numbers you type are never sent to a server, stored or shared, and you do not need an account. Results update when you press the calculate button, and the reset button clears them. We review the formulas whenever published guidelines or tax figures change, and the page was last reviewed in November 2026. If you spot a number that looks wrong, or would like another feature added, please contact us and include your inputs so we can reproduce the issue. Remember that every calculator is a simplification of real life: treat the output as a starting point for planning and check important decisions with a qualified professional.

Frequently asked questions

How do you calculate slope?

Divide the change in y by the change in x: m = (y2 - y1) / (x2 - x1). For (1, 2) and (4, 8), m = 6 / 3 = 2.

What does a slope of 0 mean?

A slope of 0 means the line is horizontal. y stays the same as x changes.

What is an undefined slope?

A vertical line has an undefined slope because the run (change in x) is zero, and you cannot divide by zero.

How do I convert slope to degrees?

Take the arctangent of the slope. A slope of 1 is 45 degrees and a slope of 0.25 is about 14.04 degrees.

How do I calculate percent slope?

Divide rise by run and multiply by 100. A 3-foot rise over 50 feet is a 6% grade.

What is the maximum slope for a wheelchair ramp?

The ADA standard is 1:12, or 8.33%: one inch of rise for every 12 inches of ramp run.

What is the slope of a perpendicular line?

The negative reciprocal of the original slope. If a line has slope 3/4, a perpendicular line has slope -4/3.

Ramp and roof figures are general guides. Building codes, accessibility rules and manufacturer requirements vary by location and product, so confirm requirements with your local code official or a licensed professional.