Mathematics · Interactive tool
Line Through Two Points
Find a line equation, including vertical and horizontal lines.
Your inputs
Result
Calculated output
Enter inputs to calculate.
For x2 ≠ x1: m = (y2-y1)/(x2-x1), c = y1-m x1, and y = m x+c. x1,y1 and x2,y2 are the two points; m is slope and c is the y-intercept.
For x2 = x1 with distinct y values, the line is x = x1 and slope is undefined. Identical points do not determine a unique line. Coordinates are numerical values on consistently chosen axes.