Show the math
m = (y2 − y1) / (x2 − x1) = (9 − 3) / (4 − 1) = 6 / 3 = 2b = y1 − m × x1 = 3 − 2 × 1 = 1y = mx + b: y = 2x + 1y − y1 = m(x − x1): y - 3 = 2(x - 1)Ax + By = C with A = Δy, B = −Δx, C = A × x1 + B × y1, then divide by the greatest common factor: 2x - y = -1angle = atan(m) = atan(2) = 63.4349°grade = 100 × m = 100 × 2 = 200%N = 1 / |m| = 1 / 2 = 0.5, so 1:0.5 (1 up for every 0.5 across)d = sqrt(Δx² + Δy²) = sqrt(3² + 6²) = 6.7082((x1 + x2) / 2, (y1 + y2) / 2) = ((1 + 4) / 2, (3 + 9) / 2) = (2.5, 6)Short answer: Slope is rise divided by run: m = (y2 − y1) / (x2 − x1). For (1, 3) and (4, 9) the rise is 6 and the run is 3, so m = 6/3 = 2: the line rises 2 units for every 1 unit you move right.
The slope fixes how steep a line is and which way it leans. The same number also gives the percent grade of a ramp or road, the angle of an incline and the 1:N ratio builders quote. This page covers the formula, the equation forms that follow from it, the vertical and horizontal cases and the grade conversions.
This article contains Amazon affiliate links. 33science earns a commission on qualifying purchases. See our affiliate disclosure.
How to use the slope calculator

The slope formula
In words: slope equals the change in y divided by the change in x, or rise over run. In symbols, for a line through (x1, y1) and (x2, y2), m = (y2 − y1) / (x2 − x1) (OpenStax Intermediate Algebra).
Worked example with (1, 3) and (4, 9):
Because slope is also the tangent of the angle the line makes with the horizontal (MathWorld), the angle is the inverse tangent of 2, which is 63.43°. The distance between the points is 6.708 and the midpoint is (2.5, 6).
The slope of a line: positive, negative, zero or undefined
A straight line has one slope everywhere along it. Its sign tells you the direction the line takes as you read it from left to right.
| Slope | What the line does | When it happens | Example |
|---|---|---|---|
| Positive | Rises | y grows as x grows | m = 2, y = 2x + 1 |
| Negative | Falls | y shrinks as x grows | m = -2/3 (-0.6667), y = -(2/3)x + 5 |
| Zero | Horizontal | y1 = y2, so the rise is 0 | y = -6 |
| Undefined | Vertical | x1 = x2, so the run is 0 | x = -3 |
A horizontal line has a slope of zero because nothing is gained in y. A vertical line has an undefined slope because the formula divides by a run of zero, and division by zero has no value (OpenStax). The two are different cases: zero is a number, undefined is the absence of one. A vertical line is written as x = c, like x = -3, and has no slope-intercept form. The calculator labels each result as rising, falling, horizontal or vertical.
The steeper the line, the larger the size of m. A slope of -0.6667 is gentler than one of 2, and the minus sign only says it leans the other way.
Slope intercept form and point slope form
Once you have m, one more point gives the equation of the line. The calculator writes it three ways (OpenStax).
Slope-intercept form
The form is y = mx + b, where b is where the line crosses the y axis. Find b with b = y1 − m × x1. For the example, b = 3 − 2 × 1 = 1, so the line is y = 2x + 1 with y-intercept (0, 1) and x-intercept (-0.5, 0).
Point-slope form
The form is y − y1 = m(x − x1) (MathWorld). It needs no intercept: put in a point and the slope. With (1, 3) and m = 2 it reads y – 3 = 2(x – 1). Use point-and-slope mode when that is all you know.
| Form | Pattern | Example |
|---|---|---|
| Slope-intercept | y = mx + b | y = 2x + 1 |
| Point-slope | y − y1 = m(x − x1) | y – 3 = 2(x – 1) |
| Standard | Ax + By = C | 2x – y = -1 |
All three describe the same line. Expand the point-slope example and it becomes the slope-intercept one.
Slope as percent grade, angle and ratio
Percent grade is the slope times 100: grade = rise / run × 100, measured against horizontal distance (FHWA). A road that climbs 2 m over 40 m has a slope of 1/20, a grade of 5% and an angle of 2.862°. The angle is the inverse tangent of the slope, and the ratio 1:N means 1 unit of rise for N units of run.
| Ratio (rise:run) | Slope m | Percent grade | Angle |
|---|---|---|---|
| 1:20 | 0.05 | 5% | 2.862° |
| 1:12 (ADA maximum ramp) | 0.08333 | 8.333% | 4.764° |
| 1:8 | 0.125 | 12.5% | 7.125° |
| 1:4 | 0.25 | 25% | 14.04° |
| 1:2 | 0.5 | 50% | 26.57° |
| 1:1 | 1 | 100% | 45° |
| 2:1 | 2 | 200% | 63.43° |
Grade is not capped at 100%. A grade of 100% is a 45° line, and steeper lines pass it: 200% is 63.43°. The angle never reaches 90°: a 90° line is vertical and has no defined grade.
For ramps, the US Access Board sets the maximum running slope at 1:12 (US Access Board). That is a slope of 0.08333, 8.333% or 4.764°. A ramp that climbs 30 inches at that slope needs 360 inches (30 feet) of run.
Common slope mistakes
The usual slip is an inverted fraction. Run over rise for the example gives 3 / 6, the reciprocal of the true 2, so check that a line that looks steep has a large number. Mixed-up signs come next: when one subtraction runs left to right and the other right to left, the sign of m flips.
Slope in the real world
Ramps, driveways, stairs, drainage and roads all describe steepness as a slope. A builder measures the vertical rise and the horizontal run separately, then divides.

A digital level or angle gauge reads the angle of a surface directly. Convert it with m = tan(angle), or enter the rise and run you measured in ratio mode to get the grade.

The same slope reads as a ratio in one trade and a percent in another. 1:20, 5% and 2.862° are one slope, and the table above converts between them.
Sources
- OpenStax. Intermediate Algebra 2e, 3.2 Slope of a Line
- OpenStax. Intermediate Algebra 2e, 3.3 Find the Equation of a Line
- Wolfram MathWorld. Slope
- Wolfram MathWorld. Point-Slope Form
- FHWA. Sidewalks and Pedestrian Facilities, Chapter 5
- US Access Board. Chapter 4: Ramps and Curb Ramps
Frequently asked questions
The slope formula is m = (y2 – y1) / (x2 – x1), the change in y divided by the change in x. For the points (1, 3) and (4, 9) it gives 6 / 3 = 2.
The slope of a horizontal line is 0, because both points have the same y value and the rise is 0. Its equation has the form y = c, such as y = -6.
The slope of a vertical line is undefined, because both points have the same x value and the formula divides by a run of 0. Its equation has the form x = c, such as x = -3.
A positive slope means the line rises from left to right and a negative slope means it falls. A slope of -2/3 falls 2 units for every 3 units you move right.
Divide the percent by 100 to get the slope, then take the inverse tangent of it. A grade of 5% is a slope of 0.05, which is 2.862 degrees.
A 10% slope rises 1 unit for every 10 units of run, written 1:10. Its angle is 5.711 degrees.
Yes. A grade of 100% is a 45 degree line, and any steeper line is above 100%. A slope of 2 is 200% at 63.43 degrees.
Write the equation as y = mx + b and read m, the number multiplying x. In y = 2x + 1 the slope is 2.