Enter two points to calculate the slope, y-intercept, and equation of the line through them.
How to Use the Equation of a Line Calculator
Enter the coordinates of two points on the line. The slope, y-intercept, and full equation come out below.
slope (m) = (y2 − y1) ÷ (x2 − x1)
y-intercept (b) = y1 − m × x1
equation: y = mx + b
Two points are always enough to pin down exactly one line — the slope formula measures how steeply it rises between them, and plugging that slope back into either point isolates where the line would cross the y-axis. The one case this breaks is a vertical line (x1 equals x2), where the slope formula divides by zero; a vertical line's equation is simply x = that shared x-value, and this calculator flags that case rather than reporting an undefined slope as if it were a number.