Math tools

Find slope from two points

Slope calculator

Enter two coordinate points to calculate rise, run, and slope, including horizontal and vertical-line cases.

Calculated in your browser

Formula and steps included

No account. No signup.

Formula

The slope formula

Slope: m = (y₂ − y₁) / (x₂ − x₁), when x₂ ≠ x₁

Slope measures vertical change per unit of horizontal change. It is often described as rise over run and keeps the subtraction order consistent for both coordinates.

A positive slope rises from left to right, a negative slope falls, and zero is horizontal. When the run is zero, the line is vertical and its slope is undefined.

How to use the formula

  1. Label the two points

    Assign the coordinates consistently as (x₁, y₁) and (x₂, y₂).

  2. Calculate the rise

    Subtract y₁ from y₂ to find the vertical change.

  3. Calculate the run

    Subtract x₁ from x₂ in the same point order used for the y-values.

  4. Divide and interpret

    Divide rise by run when the run is nonzero, then use the sign to describe the line's direction.

Worked examples

Slope calculator examples

Positive slope

Between (2, 3) and (6, 11), m = (11 − 3) / (6 − 2) = 8/4 = 2.

Vertical line

Between (4, −1) and (4, 7), the run is 4 − 4 = 0, so the slope is undefined.

Common questions

Slope calculator FAQ

What is the slope of a horizontal line?

Its slope is zero because the y-values do not change, making the rise zero while the run is nonzero.

Why is a vertical line's slope undefined?

Both points have the same x-value, so the run is zero. The slope formula would require division by zero, which is undefined.

Does switching the two points change the slope?

No, if you reverse both subtraction orders. Both the rise and run change sign, leaving their quotient unchanged.

Are my coordinates stored?

Your coordinates are not saved by default or uploaded. You can opt into Remember on this device or download a local JSON backup.