Line Equation Calculator

Enter the coordinates of two points on the line.

First point, x coordinate.

Second point, x coordinate.

This result is an estimate only. Double-check important figures before relying on them.

How it is calculated

  • Slope m = (y₂ − y₁) ÷ (x₂ − x₁)
  • Intercept b = y₁ − m × x₁
  • Equation: y = mx + b, and for a vertical line x = x₁

For only the slope, use the slope calculator.

Worked example

Points (0, 1) and (2, 5):

  • Slope = 4 ÷ 2 = 2, intercept = 1
  • Equation: y = 2x + 1

Why your number may differ

Values are rounded to 6 decimal places in the text. Some books write the line as Ax + By = C instead.

Frequently asked questions

How do I find the equation of a line from two points?

Find the slope m = (y₂ − y₁) ÷ (x₂ − x₁), then the intercept b = y₁ − m × x₁. The line is y = mx + b.

What if the line is vertical?

If both points have the same x, the slope is undefined and the equation is x = that value.

What does the slope mean?

How much y changes for each 1 step in x. A positive slope rises to the right, a negative one falls.