Beginner

Line Equation Calculator

Enter two points and get the equation of the line through them, in every form, with a graph.
Last updated: June 22, 2026 · Reviewed by TG we-Calculate Editorial Team
Point A (x₁, y₁)
Point B (x₂, y₂)
Slope-intercept form
y = 2x
Slope (m)
2
Y-intercept (b)
0
X-intercept
-0
Point-slope form
y − 2 = 2 · (x − 1)
Standard form
2x − y = 0
AB
Step by step
  1. 1

    Rise (Δy)

    y₂ − y₁ = 8 − 2 = 6
  2. 2

    Run (Δx)

    x₂ − x₁ = 4 − 1 = 3
  3. 3

    Slope m = Δy ÷ Δx

    6 ÷ 3 = 2
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Formula
m = (y₂ − y₁) ÷ (x₂ − x₁); b = y₁ − m·x₁; y = mx + b
How this is calculated

A straight line through two points is fully determined by its slope and where it crosses the y-axis. The slope m is the rise over the run — the change in y divided by the change in x: m = (y₂ − y₁) ÷ (x₂ − x₁). Once you have the slope, the y-intercept b is found by substituting either point into y = mx + b and solving, which gives b = y₁ − m·x₁.

From these two numbers the calculator writes the line in three equivalent forms: slope-intercept (y = mx + b), point-slope (y − y₁ = m(x − x₁)), and standard form (Ax + By = C with integer coefficients). The x-intercept, where the line crosses the x-axis, is −b ÷ m.

Two special cases are handled separately. If both points have the same x-value the line is vertical, the slope is undefined, and the equation is simply x = x₁. If the two y-values are equal the line is horizontal with slope 0 and equation y = y₁.

Examples
InputResult
(1, 2) and (4, 8)y = 2x
(0, 3) and (2, 7)y = 2x + 3

Frequently asked questions

Compute the slope m = (y₂ − y₁)/(x₂ − x₁), then the y-intercept b = y₁ − m·x₁. The line is y = mx + b.

The line is vertical, its slope is undefined, and the equation is x = x₁ (a constant).

Ax + By = C with integer coefficients and A ≥ 0. It is derived from the slope-intercept form by clearing fractions and moving the x-term to the left.

Also known as

line equation
equation of a line
equation of line from two points
slope intercept form
standard form
point slope form
line from two points
ax by c calculator

APA

TG we-Calculate Editorial Team. (2026). Line Equation Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/line-equation-calculator

Chicago

TG we-Calculate Editorial Team. "Line Equation Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/line-equation-calculator.

IEEE

TG we-Calculate Editorial Team, "Line Equation Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/line-equation-calculator

BibTeX

@misc{wecalculate_line_equation_calculator, title = {Line Equation Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/line-equation-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?