Skip to content
CalcWorld

Browse all tools

Slope Calculator

This slope calculator finds the slope of the line through two points: the rise divided by the run, m = (y₂ − y₁) ÷ (x₂ − x₁). Through (1, 2) and (4, 8) the slope is 6 ÷ 3 = 2.

Sources: OpenStax Algebra and Trigonometry 2e, Wikipedia Updated

Point 1
Point 2

Slope through (1, 2) and (4, 8)

m = 2

Equation
y = 2x
y-intercept
0
Angle with the x-axis
63.43°
Distance between the points
≈ 6.708204
Midpoint
(2.5, 5)
xy11.5−1.46−0.2845.28(1, 2)(4, 8)
Show steps Here’s how we got it
  1. Label the two points

    (x1, y1) = (1, 2)

    (x2, y2) = (4, 8)

    It does not matter which point you call the first, as long as you keep the order the same in both subtractions.

  2. Find the rise (change in y)

    y2 − y1 = 8 − 2 = 6

  3. Find the run (change in x)

    x2 − x1 = 4 − 1 = 3

  4. Divide rise by run

    m = rise/run = 6/3 = 2

    Positive slope: the line goes up from left to right.

  5. Find the y-intercept

    b = y1 − m × x1 = 2 − 2 × 1 = 0

    This is where the line crosses the y-axis.

  6. Write the equation of the line

    y = 2x

    Slope-intercept form is y = mx + b.

The slope formula

m=riserun=y2−y1x2−x1m = \frac{\text{rise}}{\text{run}} = \frac{y_2 - y_1}{x_2 - x_1}

The slope m says how much y changes when x goes up by 1. Once you have it, the y-intercept and the equation of the line follow, in the slope-intercept form used by OpenStax Algebra and Trigonometry:

b=y1−mx1y=mx+bb = y_1 - m x_1 \qquad y = mx + b

How to find the slope from two points: a worked example

Find the slope and the equation of the line through (−2, 5) and (4, −1).

  1. Label the two points

    (x1, y1) = (−2, 5)

    (x2, y2) = (4, −1)

    It does not matter which point you call the first, as long as you keep the order the same in both subtractions.

  2. Find the rise (change in y)

    y2 − y1 = −1 − 5 = −6

  3. Find the run (change in x)

    x2 − x1 = 4 − (−2) = 6

  4. Divide rise by run

    m = rise/run = −6/6 = −1

    Negative slope: the line goes down from left to right.

  5. Find the y-intercept

    b = y1 − m × x1 = 5 − (−1) × (−2) = 3

    This is where the line crosses the y-axis.

  6. Write the equation of the line

    y = −x + 3

    Slope-intercept form is y = mx + b.

Answer: m = −1

xy8.46−4.46−4.576.57(−2, 5)(4, −1)
Slope calculator example on a grid: the line through (−2, 5) and (4, −1) with run 6 and rise −6, so m = −6 ÷ 6 = −1, y-intercept 3 and equation y = −x + 3.
The run and rise are the two legs of a right triangle under the line. A rise going down makes the slope negative.

Positive, negative, zero and undefined slope

SlopeThe lineExample
PositiveRises from left to righty = 2x + 1
NegativeFalls from left to righty = −x + 3
ZeroHorizontaly = 3
UndefinedVerticalx = 2
Four slope graphs: y = 2x + 1 rises (positive slope 2), y = −x + 3 falls (negative slope −1), y = 3 is flat (zero slope) and x = 2 is vertical (undefined slope).
The sign of the slope tells you the direction before you work out its size.

The calculator also gives the distance between the two points and their midpoint.

Slope as a rate of change

When x and y are real quantities, the slope is a rate: kilometres per hour, dollars per item, degrees per day. Between two points on a curve it is the average rate of change.

When the data has more than two points that do not lie on one line, the best single slope comes from the linear regression calculator, which fits the least-squares line.

Slope as a percentage, a ratio and an angle

Road signs and building plans usually give slope as a percent grade: the slope times 100, or the rise for every 100 units of run. A 1:100 slope rises 1 for every 100 across, which is a slope of 0.01 or 1%. The angle with the horizontal is the inverse tangent of the slope, as Wikipedia's article on grade sets out.

Percent gradeSlope mRatio (rise:run)Angle
1%0.011:1000.57°
2%0.021:501.15°
5%0.051:202.86°
6%0.061:16.673.43°
8.33%0.08331:124.76°
10%0.11:105.71°
25%0.251:414.04°
50%0.51:226.57°
100%11:145°

A 1% slope falls 1 inch over 100 inches of run, or 0.12 inch per foot. For any other grade, enter (0, 0) and (100, the percent) as the two points: the calculator gives the slope and its angle with the x-axis.

Slope practice question

Find the slope of the line through (3, 7) and (5, 15), and write its equation.

Check your answer

Answer: m = 4

  1. Label the two points

    (x1, y1) = (3, 7)

    (x2, y2) = (5, 15)

    It does not matter which point you call the first, as long as you keep the order the same in both subtractions.

  2. Find the rise (change in y)

    y2 − y1 = 15 − 7 = 8

  3. Find the run (change in x)

    x2 − x1 = 5 − 3 = 2

  4. Divide rise by run

    m = rise/run = 8/2 = 4

    Positive slope: the line goes up from left to right.

  5. Find the y-intercept

    b = y1 − m × x1 = 7 − 4 × 3 = −5

    This is where the line crosses the y-axis.

  6. Write the equation of the line

    y = 4x − 5

    Slope-intercept form is y = mx + b.

Questions about slope

How do you find the slope from two points?

Subtract the y-values to get the rise, subtract the x-values in the same order to get the run, and divide rise by run. For (1, 2) and (4, 8): the rise is 8 − 2 = 6, the run is 4 − 1 = 3, and the slope is 6 ÷ 3 = 2.

Does it matter which point is first?

No, as long as you use the same order for both subtractions. Swapping the points changes the sign of the rise and of the run, and the two changes cancel when you divide.

What is the slope of a vertical line?

It is undefined. Both points have the same x-value, so the run is 0, and you cannot divide by zero. The equation of the line is x = that value.

What is the slope of a horizontal line?

Zero. Both points have the same y-value, so the rise is 0, and 0 divided by any run is 0. The equation of the line is y = that value.

How do you get the equation of the line from the slope?

Use y = mx + b. Put the slope in for m, then put one of the points in for x and y and solve for b. With slope 2 through (1, 2): 2 = 2 × 1 + b, so b = 0 and the line is y = 2x.

What does a negative slope mean?

The line goes down as you move from left to right: y gets smaller as x gets larger. A positive slope goes up from left to right.

How steep is a 6% slope?

A 6% slope rises 6 units for every 100 units across, a slope of 6 ÷ 100 = 0.06. Its angle with the horizontal is the inverse tangent of 0.06, about 3.43°. Over 50 feet of run it climbs 3 feet.

What is a 2% slope in degrees?

About 1.15°. A 2% slope rises 2 for every 100 across, a slope of 0.02, and the angle is the inverse tangent of that: tan⁻¹(0.02) ≈ 1.15°. A 1% slope is about 0.57° and a 5% slope about 2.86°.

Sources