Slope Calculator

Slope is rise over run: how much y changes for each step in x. Enter two points to get the slope and the equation of the line through them.

Also called: Gradient calculator · Rise over run calculator

  • Last updated
  • Formula tested against reference values

Your numbers

Result

Slope (m)
—

Calculating…

Slope as a fraction
—
Equation of the line
—
y-intercept (b)
—
Angle to the x-axis
—
Rise (Δy)
—
Run (Δx)
—
Distance between the points
—
Midpoint
—

How to use this calculator

  1. Enter or choose x₁.
  2. Enter or choose y₁.
  3. Enter or choose x₂.
  4. Enter or choose y₂.
  5. The slope (m) updates as you type. Use Copy result or Share to keep it.

Method

m = (y₂ − y₁) ÷ (x₂ − x₁); b = y₁ − m·x₁; θ = arctan m; d = √((x₂ − x₁)² + (y₂ − y₁)²)

(x₁, y₁), (x₂, y₂)
the two points
m
slope
b
where the line crosses the y-axis
θ
angle of the line above the x-axis

Worked example

  1. Rise = 5 − 2 = 3; run = 5 − 1 = 4; m = 3 ÷ 4 = 0.75.
  2. b = 2 − 0.75 × 1 = 1.25, so y = 0.75x + 1.25.
  3. Distance = √(4² + 3²) = √25 = 5.

The line through (1, 2) and (5, 5) has slope 3/4 and equation y = 0.75x + 1.25.

What the result means

A positive slope rises from left to right, a negative one falls. A slope of 0.75 means y goes up 3 for every 4 across, or 75% as a road or ramp grade.

Assumptions and limits

  • Points are on a flat x–y plane with the same scale on both axes (the angle depends on this).
  • A vertical line (x₁ = x₂) has no defined slope; the calculator gives its equation as x = constant.

Questions

What is the difference between slope and grade?

Grade is slope written as a percentage: a slope of 0.05 is a 5% grade, rising 5 m over 100 m horizontally.

Do parallel and perpendicular lines have related slopes?

Parallel lines have equal slopes. Perpendicular lines have slopes that multiply to −1, such as 2 and −½.