Skip to content

Slope Calculator

Slope, equation and angle from two points.

Inputs

Loading calculator…
Calculating…

Use this calculator on your own site

Free embed

  • Two lines of HTML, unlimited views
  • Shows a small CalculateEveryday bar, with a credit link under the calculator

Formula

m = (y₂ − y₁) ÷ (x₂ − x₁); then b = y₁ − m·x₁ gives y = mx + b

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1}

Slope is the vertical change (rise) divided by the horizontal change (run) between any two points on the line. Once m is known, substituting either point into y = mx + b gives the y-intercept b. The angle the line makes with the x-axis is the inverse tangent of the slope.

Worked example

From (2, 3) to (6, 11) the line rises 8 while running 4, so m = 8 ÷ 4 = 2. Substituting (2, 3): b = 3 − 2 × 2 = −1, giving y = 2x − 1. The line climbs at about 63.43° to the x-axis.

Where this can give the wrong answer

  • When both points share an x-coordinate the run is zero and the slope is undefined — the line is vertical and is written x = a constant, not y = mx + b.
  • When both points share a y-coordinate the slope is 0 and the equation collapses to y = a constant.
  • The slope as a fraction is only shown when all four coordinates are whole numbers; with decimals a reduced fraction would be a rounding of a rounding.
  • Swapping the two points changes the sign of both rise and run, so the slope is the same either way.

FAQ

No. Reversing them makes rise and run both change sign, and the signs cancel. Just keep each point's x and y together.

Need this calculator, but different?

MakeACalc turns a plain-English description into an embeddable calculator — formula and worked example included. Launching soon.