Skip to content
MasterMath

Equation of a Line Calculator

The equation of the line through two points, in all three standard forms: slope-intercept, point-slope and general.

Slope-intercept form

—

Slope-intercept form—
Point-slope form—
General form—
Slope—
It crosses the y-axis at—

How it was solved

    The formula

    y − y₁ = m(x − x₁) → y = mx + b

    Why it works

    Two points determine a line, and the line has one equation written three different ways. Point-slope comes straight from the definition of slope; rearranging it gives slope-intercept; multiplying out and collecting gives the general form Ax + By + C = 0.

    How to solve it by hand

    1. Work out the slope from the two points
    2. Substitute one point into y − y₁ = m(x − x₁)
    3. Expand and rearrange for y = mx + b
    4. Collect everything on one side for Ax + By + C = 0

    What is worth knowing

    Each form earns its place. Slope-intercept is best for graphing, because you can read the slope and the starting point straight off. Point-slope is best for constructing a line when you know a point and a direction, which is what you have most of the time. The general form is the one that survives the vertical case: x = 3 has no slope-intercept form at all, but it writes perfectly as 1x + 0y − 3 = 0. That robustness is why the general form is what computer graphics and linear algebra actually use.

    Frequently asked questions

    Which form should I use?

    Slope-intercept for graphing, point-slope for building the equation from a point and a slope, general form when the line might be vertical.

    How do I write a vertical line?

    As x = a constant. It has no slope-intercept form, but the general form handles it: 1x + 0y − a = 0.

    What is b in y = mx + b?

    The y-intercept: the value of y where the line crosses the y-axis, which is where x = 0.

    Can two points always define a line?

    Yes, as long as they are different points. Two identical points define infinitely many lines.