Skip to main content

Equation of a Line Calculator

An equation of a line calculator builds slope m, y-intercept b, slope-intercept form, point-slope form, standard form, and the x-intercept from two points, from a point plus slope, or from m and b directly. Vertical segments report x = constant with undefined slope.

Results

How to find the equation of a line

  1. Choose Start from: two points, point and slope, or slope and y-intercept.
  2. Enter the fields that appear. Default two points are (0, 1) and (2, 5).
  3. Read slope m, y-intercept b, x-intercept, slope-intercept, point-slope, and standard form.
  4. If both x values match, read the vertical equation x = constant. Open intercepts or slope pages for related jobs.

Equation of a Line Calculator

Plane line from points or slope data

Slope formulam = (y2 - y1) / (x2 - x1) when x1 != x2
Y-interceptb = y1 - m x1
X-intercept-b / m when m != 0
Slope-intercept formy = mx + b
Point-slope formy - y1 = m(x - x1)
Vertical linex = x1 when both points share the same x

What an equation of a line calculator returns

An equation of a line calculator describes the unique non-vertical line through known data as y = mx + b, plus matching point-slope and standard forms. Slope m is rise over run. The y-intercept b is where the line crosses the vertical axis. The default points (0, 1) and (2, 5) give m = 2 and y = 2x + 1.

Slope-intercept, point-slope, and standard forms

Slope-intercept writes the line with slope and the intercept on the y-axis: y = mx + b. Point-slope keeps the same slope but anchors at a known point: y - y1 = m(x - x1). Standard form here rearranges to Ax + By = C from y = mx + b (with B = -1). All three describe the same geometry when the line is not vertical.

How this page builds the equation

From two distinct points, the engine computes m = (y2 - y1)/(x2 - x1) when x differs, then b = y1 - m x1. From a point and slope it recovers b the same way. From m and b it starts in slope-intercept form. When x1 equals x2 it returns x = that shared value and marks slope undefined. Coincident points raise an error because they do not determine a unique line. Horizontal lines (m = 0) report y = b and no x-intercept.

Equation of a line worked examples

Two points (0, 1) and (2, 5): m = (5 - 1)/(2 - 0) = 2, b = 1, so y = 2x + 1. Point-slope through the first point: y - 1 = 2(x - 0). X-intercept = -1/2 = -0.5. Standard form: 2x + (-1)y = -1.

Vertical: points (3, 1) and (3, 8) give x = 3 with undefined slope.

Horizontal: m = 0 and b = 4 give y = 4 with no x-intercept.

When to use this calculator

Check algebra homework that names two points, turn a CAD sketch edge into y = mx + b, or confirm a trend line before you graph it. Great-circle paths and 3D space lines are not this form.

Limits

Plane Cartesian only. No polar form and no parametric vector form. Coefficients stay in decimal float form (no forced integer clearing). IEEE floating point applies. CZNull does not receive the numbers.

Equation of a line calculator questions

What equation do (0, 1) and (2, 5) produce?
Slope m = 2 and y-intercept b = 1, so y = 2x + 1. Point-slope through the first point is y - 1 = 2(x - 0). The x-intercept is -0.5.
What happens when both points share the same x?
The page reports a vertical line x = that value. Slope is undefined and y = mx + b does not apply.
Can I start from slope and a point only?
Yes. Choose Point and slope, enter m with (x1, y1), and the page recovers b and the other forms.
Why must the two points be distinct?
One point alone does not fix a unique line. Identical coordinates raise an error so the form stays determined.
Is point-slope the same as slope-intercept?
They describe the same non-vertical line. Slope-intercept isolates b. Point-slope keeps an explicit known point.
Does this print integer standard form?
No. Standard form here is the direct rearrange mx - y = -b in decimal coefficients. Clearing fractions by hand is a separate homework step.