Simple tools for everyday life.

Slope of a Line Calculator

Calculate the slope between two points and the equation of the line.

Tip: Slope = (y₂ − y₁) / (x₂ − x₁). Positive = up, negative = down, 0 = horizontal.

Loading tool…

Did this tool help?

About this digital tool

The slope calculator finds the gradient of the line passing through two points. Enter the coordinates (x1, y1) and (x2, y2) and get the slope, the equation of the line in the form y = mx + b and the y-intercept.

The formula is m = (y2 − y1) ÷ (x2 − x1). For the points (0, 0) and (4, 2) the slope is 2 ÷ 4 = 0.5. For the points (1, 2) and (3, 8) the slope is 6 ÷ 2 = 3, the intercept b = 2 − 3 × 1 = −1 and the equation y = 3x − 1. A positive slope means a rising line, a negative one a falling line, zero a horizontal line. It is used in algebra, in graphing, in construction (roof pitch) and in trend analysis.

How to use

  1. Enter the coordinates of the first point (x1, y1).
  2. Enter the coordinates of the second point (x2, y2), with x2 different from x1.
  3. Read the slope m in the result bar.
  4. See the equation y = mx + b and the y-intercept.

Frequently asked questions

What does slope show?

How fast the line rises or falls. A slope of 2 means: for every 1 unit to the right, the line goes up 2 units. A slope of −1 means it falls 1 unit.

How is the slope of a line calculated from two points?

m = (y2 − y1) ÷ (x2 − x1). E.g. for (1, 2) and (3, 8): m = (8 − 2) ÷ (3 − 1) = 3.

What happens when both points have the same x?

The line is vertical and the slope is undefined, because you divide by zero. The calculator requires two different x values.

How do I find the equation y = mx + b?

Calculate m, then b = y1 − m × x1. E.g. for (1, 2) and m = 3: b = 2 − 3 = −1, so y = 3x − 1.