Mathematics · Updated 2026

Slope Calculator

Enter two coordinate points and instantly get the slope, line equation (y = mx + b), distance between points, midpoint, and angle of inclination. Full step-by-step solution included.

Last updated · ADA ramp slope limits checked against the 2010 ADA Standards

Slope (m)
Line Equation y = mx + b
Distance & Midpoint
Angle of Inclination
Our networkdiscount5Fresh deals. Five at a time.Price drops and coupon codes, ending soonest first.See today’s deals
Δy/Δx
Slope Calculator
m = (y&sub2;−y&sub1;) / (x&sub2;−x&sub1;)
x y P\u2081(x\u2081,y\u2081) P\u2082(x\u2082,y\u2082) run rise m = rise/run
Point 1 (x₁, y₁)
Point 2 (x₂, y₂)
Quick Examples: click to load
(0,0) → (1,1)
slope = 1
(0,0) → (3,6)
slope = 2
(1,2) → (4,8)
slope = 2
(0,5) → (5,0)
slope = -1
(2,3) → (2,7)
vertical
(1,4) → (5,4)
horizontal

Enter two coordinate points to calculate slope, line equation, distance and midpoint.

Slope Formula Explained

Slope is rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). From (1, 2) to (4, 8) the line rises 6 over a run of 3, so the slope is 2. A horizontal line has slope 0 and a vertical line has an undefined slope. Enter two points above to get the slope, the line equation, the distance, the midpoint and the angle.

Slope (m) measures the steepness and direction of a line. It is defined as rise over run: the change in y divided by the change in x between any two points on the line. A positive slope rises left to right; negative falls; zero is horizontal; undefined is vertical.

Slope Formula

m = (y₂−y₁) / (x₂−x₁) = rise / run. Example: points (1,2) and (4,8). m = (8−2)/(4−1) = 6/3 = 2. The line rises 2 units for every 1 unit right.

Slope-Intercept Form

y = mx + b, where m is slope and b is the y-intercept (where the line crosses y = 0). Example: m = 2, point (1,2). b = y−mx = 2−2(1) = 0. Equation: y = 2x.

Distance Formula

d = √((x₂−x₁)² + (y₂−y₁)²). This is the Pythagorean theorem applied to coordinate geometry. The horizontal and vertical distances are the two legs.

Midpoint Formula

M = ((x₁+x₂)/2, (y₁+y₂)/2). The midpoint is the average of the x-coordinates and the average of the y-coordinates of the two endpoints.

Slope as Ratio, Percent Grade and Degrees

The same steepness can be written three ways. Percent grade is the slope times 100, and the angle is arctan(slope). A 100% grade is 45°, not vertical.

Rise : runSlope mPercent gradeAngle
1 : 200.055%2.86°
1 : 120.08338.33%4.76°
1 : 100.110%5.71°
1 : 80.12512.5%7.13°
1 : 40.2525%14.04°
1 : 20.550%26.57°
1 : 11100%45°
2 : 12200%63.43°
4 : 14400%75.96°

Under the 2010 ADA Standards, a walking surface steeper than 1:20 counts as a ramp, and a ramp may be no steeper than 1:12. Going the other way from degrees: 5° is an 8.75% grade, 10° is 17.63% and 30° is 57.74%.

Roof Pitch to Degrees

Roof pitch gives the rise in inches for every 12 inches of run, so a 6/12 roof has a slope of 6 ÷ 12 = 0.5.

PitchSlopePercent gradeAngle
2/120.166716.67%9.46°
3/120.2525%14.04°
4/120.333333.33%18.43°
5/120.416741.67%22.62°
6/120.550%26.57°
8/120.666766.67%33.69°
10/120.833383.33%39.81°
12/121100%45°

Worked Examples

A negative slope

Points (−2, 5) and (4, −1). Rise = −1 − 5 = −6, run = 4 − (−2) = 6, so m = −1. The intercept is b = 5 − (−1)(−2) = 3, giving y = −x + 3. The line falls one unit for each unit to the right and meets the x-axis at 135°.

A decimal slope

Points (3, −2) and (7, 4). m = 6 ÷ 4 = 1.5 and b = −2 − 1.5 × 3 = −6.5, so y = 1.5x − 6.5. The distance between the points is √(4² + 6²) = 7.21 and the angle of inclination is 56.31°.

A vertical line

Points (2, 3) and (2, 7). The run is 0, and dividing by zero has no answer, so the slope is undefined. The line is x = 2, and any line perpendicular to it is horizontal with slope 0.

Ramp and road grades

A ramp that climbs 30 inches at the 1:12 maximum needs 30 × 12 = 360 inches, or 30 ft, of run. A road at a 6% grade climbs 0.06 × 5,280 = 316.8 ft over one mile.

Common Mistakes

  • Subtracting in a different order. If you take y₂ − y₁ on top, take x₂ − x₁ below. Mixing the order flips the sign.
  • Run over rise. Slope is the vertical change divided by the horizontal change, not the other way round.
  • Percent read as degrees. A 100% grade is 45°. A 10% road is only 5.71°.
  • Zero and undefined mixed up. Horizontal lines have slope 0. Vertical lines have no slope at all.
  • Using the same point twice. Two identical points do not define a line, so there is no slope to find.
Method and sources. Formulas: m = (y₂ − y₁) ÷ (x₂ − x₁), b = y₁ − m x₁, percent grade = 100m, angle = arctan(m). Ramp and walking surface limits: 2010 ADA Standards for Accessible Design, sections 403.3 and 405.2 (U.S. Department of Justice). Every figure on this page was computed with node using the same formulas as the calculator.

Slope Questions

Slope (m) measures how steep a line is and in which direction it goes. It is defined as rise over run: m = (y₂−y₁) / (x₂−x₁). For points (1,2) and (4,8): m = (8−2)/(4−1) = 6/3 = 2. This means the line rises 2 units vertically for every 1 unit it moves horizontally to the right. Positive slope = rises left to right. Negative slope = falls left to right. Zero slope = horizontal line. Undefined slope = vertical line.

The slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept (the value of y when x = 0, where the line crosses the y-axis). To find b: substitute the slope and one known point. Example: slope = 3, point (2,7). 7 = 3(2) + b. 7 = 6 + b. b = 1. Equation: y = 3x + 1. This is the most common way to write a line equation because it immediately shows both the slope and y-intercept.

A negative slope means the line goes downward from left to right. For every unit you move right on the x-axis, the y-value decreases. Example: m = −2 means the line falls 2 units for every 1 unit to the right. In real life: a downward ramp, decreasing temperature over time, a stock price falling, or a car decelerating. The steeper the line falls, the larger the absolute value of the slope. Slope of −0.1 is nearly flat; slope of −10 is nearly vertical going down.

A vertical line has undefined slope because the run (change in x) equals zero, and division by zero is undefined. For a vertical line, all points share the same x-coordinate. Example: points (3,1) and (3,7) give slope = (7−1)/(3−3) = 6/0 = undefined. The equation of a vertical line is simply x = c (e.g., x = 3). A horizontal line has slope 0 (zero rise). Its equation is y = c (e.g., y = 4).

Parallel lines have identical slopes and never intersect. If line 1 has slope m = 3, any parallel line also has slope m = 3. Perpendicular lines intersect at exactly 90°. Their slopes are negative reciprocals: if line 1 has slope m, any perpendicular line has slope −1/m. Example: slope 2/3 → perpendicular slope = −3/2. Special cases: a horizontal line (slope 0) is perpendicular to a vertical line (undefined slope). The product of perpendicular slopes is always −1: m&sub1; × m&sub2; = −1.

Use the distance formula: d = √((x₂−x₁)² + (y₂−y₁)²). This is the Pythagorean theorem applied to coordinate geometry: the horizontal distance (Δx) and vertical distance (Δy) form the two legs of a right triangle, and the straight-line distance is the hypotenuse. Example: points (1,2) and (4,6). d = √((4−1)² + (6−2)²) = √(9+16) = √25 = 5.

The midpoint is the average of the x-coordinates and the average of the y-coordinates: M = ((x₁+x₂)/2, (y₁+y₂)/2). Example: points (2,4) and (8,10). Midpoint = ((2+8)/2, (4+10)/2) = (5, 7). The midpoint lies exactly halfway between the two points on the line segment. It divides the segment into two equal halves. In coordinate geometry, the midpoint is used to find the center of a line segment, the centroid of a triangle, or to bisect a segment.

The angle of inclination (θ) is the angle a line makes with the positive x-axis, measured counterclockwise. It is related to slope by: tan(θ) = m, so θ = arctan(m). A horizontal line has θ = 0°. A line with slope 1 has θ = 45°. A vertical line has θ = 90°. A line with slope −1 has θ = 135°. The angle always ranges from 0° to 180° (excluding 90° for non-vertical lines). Steep lines have inclination angles close to 90°.

Point-slope form is y − y₁ = m(x − x₁), where m is slope and (x₁, y₁) is any known point on the line. This is useful when you know the slope and one point but not the y-intercept. Example: slope = 4, point (3,5). y − 5 = 4(x − 3). y − 5 = 4x − 12. y = 4x − 7. To convert to slope-intercept form, just solve for y. The slope-intercept form y = mx + b is the most common, but point-slope is often faster when you start with a known point and slope.

Slope appears in almost every field: Architecture and construction: roof pitch, ramp gradients, road grades. The ADA requires ramps to have a slope no steeper than 1:12 (about 4.76°). Economics: the slope of a demand or supply curve represents how quantity responds to price changes. Physics: slope of a distance-time graph = speed; slope of a velocity-time graph = acceleration. Statistics: the slope of a regression line shows how much y changes per unit of x. Geography: gradient of rivers and hills. Engineering: pipeline gradients for drainage. GPS and mapping: calculating elevation changes.

Multiply the slope by 100. A rise of 1 over a run of 12 is a slope of 0.0833, or an 8.33% grade. To get the angle, take the arctangent of the slope: arctan(0.0833) = 4.76°. A 100% grade means the rise equals the run, which is 45°.

A 4/12 pitch rises 4 inches per 12 inches of run, a slope of 0.3333. That is 18.43°, or a 33.33% grade. A 6/12 pitch is 26.57° and a 12/12 pitch is 45°.