Line Equation From Two Points Calculator

Line Equation from Two Points

Find the equation of a line given two points on it.

Last updated: June 2026 | By Patchworkr Team

Points

Point 1 x is required.

Results
Enter two distinct points to calculate the equation.

How It Works

Compute the slope from the two points, then solve for the y-intercept with b = y1 - mx1. If the x-values are equal, the line is vertical.

Formula

Slope
m = (y2 - y1) / (x2 - x1)
Intercept
b = y1 - mx1

Example

For (1, 2) and (3, 8), the slope is 3 and the intercept is -1.

m = (8 - 2) / (3 - 1) = 3
b = 2 - 3(1) = -1
y = 3x - 1

FAQ

What if x1 equals x2?

The line is vertical and there is no slope-intercept form.

Can the intercept be negative?

Yes. Negative intercepts are normal.

What if the points are identical?

There is no unique line through a single repeated point.

Does blank input count as zero?

No. Blank input is treated as missing, not zero.

Related Tools