Skip to content
Calc.

Slope Calculator

To find the slope of a line, divide the rise by the run between two points: m = (y₂ − y₁) ÷ (x₂ − x₁). Enter two points to get the slope, with the rise and run drawn on a graph; a vertical line has an undefined slope.

Last updated: October 2026

Slope (m)

2

Formula below · 2 sources (mathworld.wolfram.com, khanacademy.org) · Updated Oct 2026

Compare with similar

About this calculator

To find the slope of a line, take two points on it, subtract the y-values, subtract the x-values in the same order, and divide. Through (x₁, y₁) and (x₂, y₂):

m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run

Worked example with the default points (1, 2) and (4, 8): rise = 8 − 2 = 6, run = 4 − 1 = 3, so m = 6 ÷ 3 = 2. The slope says how much y changes for each one-unit step in x: here y goes up 2 for every 1 step right.

Reading the answer

What the sign of the slope means: Positive (m > 0): the line rises from left to right. Negative (m < 0): the line falls from left to right. Zero (m = 0): the line is horizontal; y never changes. Undefined: the line is vertical; x₁ = x₂, so the run is zero and you cannot divide by it.

The bigger the slope is in size, the steeper the line. The result is rounded to 2 decimal places; for an exact answer keep it as the fraction rise/run (6/3 = 2, or −2/4 = −1/2).

From the slope you can write the line in slope-intercept form y = mx + b. The intercept b is where the line crosses the y-axis: b = y₁ − m·x₁, which is 2 − 2·1 = 0 for the default points, so y = 2x. The angle is the line's incline from the x-axis, arctan(m): a slope of 1 is 45°, a slope of 2 is about 63.43°.

Grades and pitches

Road grade is slope × 100 (a slope of 0.06 is a 6% grade). Roof pitch is rise over a 12-inch run, so a slope of 0.5 is a 6/12 pitch.

Slope, angle and percent grade

Scroll sideways to see all columns →

Slope mAnglePercent grade
00°0%
0.15.71°10%
0.526.57°50%
145°100%
263.43°200%
Undefined (vertical)90°—

How to use

Enter the coordinates of two points on the line. The order does not matter, as long as x₁ and y₁ belong to the same point. Example 1: (1, 2) and (4, 8). Rise 6, run 3, so m = 2. The intercept is b = 2 − 2 × 1 = 0, so the line is y = 2x, at an angle of arctan 2 ≈ 63.43°. Example 2: (−1, 3) and (3, 1). Rise −2, run 4, so m = −1/2, shown as −0.5. b = 3 − (−0.5)(−1) = 2.5, so y = −0.5x + 2.5. The line falls as x increases. Example 3: (2, 5) and (2, 9). Both x-values are 2, so the line is vertical and the slope is undefined.

Frequently asked questions

How do you find the slope of a line?

Pick two points on the line, subtract the y-values, subtract the x-values in the same order, and divide: m = (y₂ − y₁) ÷ (x₂ − x₁), rise over run. For (1, 2) and (4, 8): (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2. From a graph, count how many units the line goes up (rise) while it goes one or more units right (run). From an equation in the form y = mx + b, the slope is the number m in front of x.

What does a negative, zero or undefined slope mean?

Negative: the line falls from left to right. Zero: the line is horizontal (y never changes). Undefined: the line is vertical, because the run x₂ − x₁ is zero and you cannot divide by zero.

How do I get the equation of the line?

Use y = mx + b. With the slope m, plug one point into b = y₁ − m·x₁. For (−1, 3) and (3, 1), m = −1/2 and b = 3 − (−1/2)(−1) = 5/2, so y = (−1/2)x + 5/2.

Does it matter which point I call the first point?

No. Swapping the points flips the sign of both the rise and the run, and the two signs cancel. What matters is that you subtract in the same order on the top and the bottom.

How do I turn a slope into an angle or a percent grade?

The angle is arctan(m): a slope of 1 is 45° and a slope of 0.5 is about 26.57°. The percent grade is m × 100, so a slope of 0.08 is an 8% grade.

Related calculators

Sources & references

How we check our calculators

Think a result is wrong? Report a problem with this calculator.