Skip to content
SnapCalculations

Slope Calculator

Enter two points to get the slope as a fraction and decimal, the equation of the line in slope-intercept form, and the distance and midpoint between them.

Slope

2

y = 2x

Equation
y = 2x
Slope as a decimal
2
y-intercept (b)
0
Rise ÷ run
6 ÷ 3
Distance between points
6.708204
Midpoint
(2.5, 5)
Angle with x-axis
63.4349°

Step-by-step solution

Worked out with your numbers. Change any value above and the steps update.

  1. 1

    Change in y (rise): y₂ − y₁

    8 − 2 = 6

  2. 2

    Change in x (run): x₂ − x₁

    4 − 1 = 3

  3. 3

    Slope: m = rise ÷ run

    6 ÷ 3 = 2

  4. 4

    y-intercept: b = y₁ − m × x₁

    2 − 2 × 1 = 0

  5. 5

    Equation of the line: y = mx + b

    m = 2, b = 0 = y = 2x

How it works

  • Slope m = (y₂ − y₁) ÷ (x₂ − x₁): the rise divided by the run.
  • The y-intercept is b = y₁ − m × x₁, giving the equation y = mx + b.
  • If x₁ = x₂ the line is vertical and its slope is undefined; if y₁ = y₂ the line is horizontal and its slope is 0.
  • Whole-number points give exact fractions such as 2/3; decimal points give decimal answers.

Frequently asked questions

Is slope the same as gradient?

Yes. “Gradient” is common in the UK and “slope” in the US. Both mean rise over run.

Does it matter which point is first?

No. Swapping the points flips the sign of both the rise and the run, so the slope stays the same.

Results are estimates for general information and are not financial, medical or professional advice.