Slope & Intercept Calculator

Find the slope and intercept from two points.

How it is calculated

From two points the tool finds the slope m = (y₂ − y₁) / (x₂ − x₁) and then the intercept b = y₁ − m × x₁, which gives the line y = m·x + b. Slope is the change in y per one unit of x, and the intercept is the value of y where the line crosses the y axis (x = 0). Both are shown with 4 decimals. If the two x values are equal the line is vertical, its slope is undefined, and the tool returns no result. Any units work as long as both points use the same ones.

Worked example

Points (2, 5) and (6, 13). Slope: (13 − 5) / (6 − 2) = 8 / 4 = 2.0000. Intercept: 5 − 2 × 2 = 1.0000. The line is y = 2x + 1. Check with the second point: 2 × 6 + 1 = 13, which matches.

Try this example →

Common mistakes

  • Subtracting in a different order on top and bottom, for example y₂ − y₁ over x₁ − x₂. That flips the sign of the slope.
  • Entering the same x for both points. A vertical line cannot be written as y = mx + b, so there is no result.
  • Swapping x and y when the data is a table with the dependent variable in the first column.
  • Reading the intercept as the value at the first point. It is the value at x = 0, which can be far from the points you entered.

About this calculator

Given two points (x₁,y₁) and (x₂,y₂), this calculator finds the slope m = (y₂−y₁)/(x₂−x₁) — the rate of change of y per unit of x — and then the y-intercept b = y₁ − m×x₁, giving the full slope-intercept equation y = mx + b for the line through both points.

It's the first algebraic tool for turning two data points into a predictive line: students use it to write linear equations from graphs, engineers and land surveyors use it to compute grade or pitch between two elevation readings, and analysts use the same arithmetic to find the rate of change between two data points in a spreadsheet before fitting a fuller regression.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators