Line Equation Two Points Calculator

Line Equation Two Points Calculator

Find the equation of the line passing through two points and see the slope-intercept form or a vertical-line result.

Last updated: June 2026 | By Patchworkr Team

Two-Point Line Solver
Line Equation
y = 1x + 1
Slope 1 and intercept 1

What Is the Two-Point Form of a Line?

The two-point form uses two known points to build the equation of a line. First find the slope, then use one point to solve for the intercept. Vertical lines are handled separately because their slope is undefined.

How to Find the Equation of a Line

  1. Enter two distinct points.
  2. Compute the slope with m = (y2 - y1) / (x2 - x1).
  3. Use b = y1 - mx1 to find the intercept if the line is not vertical.
  4. Read the equation in the result panel.
m = (y2 - y1) / (x2 - x1), b = y1 - mx1

Worked Example

Using the points (1, 3) and (3, 7), the line has slope 2 and intercept 1.

y = 2x + 1

Frequently Asked Questions

What if the two points are identical?

The calculator rejects identical points because there is no unique line through a single repeated point pair.

What happens when x1 equals x2?

The line is vertical, so the calculator returns x = constant instead of slope-intercept form.

Does the tool accept decimals?

Yes. Any finite real coordinate is accepted, including decimal and scientific notation values.

Why is a vertical line treated separately?

Because its slope is undefined, so y = mx + b does not describe it correctly.

Related Tools