Line Equation Calculator
Determine the equation of a line through two points in slope-intercept and standard forms.
About Line Equation Calculator
Given two points, the slope is m = (y₂−y₁)/(x₂−x₁). The slope-intercept form is y = mx + b, where b = y₁ − m·x₁.
Formulas
Slope
m = (y₂ − y₁) / (x₂ − x₁)
- x₁,y₁
- First point
- x₂,y₂
- Second point
Slope-Intercept Form
y = mx + b
- m
- Slope
- b
- Y-intercept
Worked example
With the default values below, Line Equation Calculator returns Line Equation of y = 2.0000x + 0.0000. Change any input above and every figure here is recalculated in your browser.
Inputs used
- x₁
- 1
- y₁
- 2
- x₂
- 4
- y₂
- 8
Results
- Line Equation
- y = 2.0000x + 0.0000
- Slope (m)
- 2.0000
- Y-Intercept (b)
- 0.0000
Step by step
- 1Slope= 2.0000
- 2Equation= y = 2.0000x + 0.0000
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 4 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
What if the line is vertical?
Vertical lines have undefined slope. The equation is simply x = constant.
How do I convert to standard form Ax + By = C?
Rearrange y = mx + b to get −mx + y = b, then multiply through to clear fractions if needed.
