How to use the Line Equation Calculator
- Enter the x- and y-coordinates of each point.
- Read the line equation and the substituted calculations.
- For a vertical line, use its x-coordinate equation rather than a slope-intercept form.
Slope-intercept and point-slope equations
Where:
- = slope
- = y-intercept
- = the two points
Show as plain text
m = (y₂ − y₁) ÷ (x₂ − x₁) b = y₁ − mx₁ y = mx + b
Subtract coordinates in the same order to find slope. Substitute either point into y = mx + b to find the intercept.
When both x-coordinates match but y-coordinates differ, the line is vertical and is written x = constant. Identical points do not determine a unique line.
Assumptions and limitations
- Coordinates are finite values from −1,000,000,000,000 through 1,000,000,000,000.
- Displayed values are rounded to eight decimal places; calculations use JavaScript floating-point arithmetic.
Example: Find the line through (1, 2) and (3, 6)
- Slope m = (6 − 2) ÷ (3 − 1) = 2.
- Intercept b = 2 − (2 × 1) = 0.
- The line equation is y = 2x.
When to use the Line Equation Calculator
- Finding a line equation from two coordinate points.
- Checking the y-intercept of a line; use the slope calculator when only the gradient is needed.
- Connecting coordinate geometry with the distance formula calculator.
Line Equation Calculator FAQs
How do I find the equation of a line from two points?
Calculate the slope from the change in y divided by the change in x, then use either point to find the y-intercept in y = mx + b.
What is the equation of a vertical line?
A vertical line has the form x = a constant. Its slope is undefined, so it cannot be written in slope-intercept form.
What if I enter the same point twice?
A single point lies on infinitely many lines, so identical points do not determine a unique line.
References
How this calculator was built and tested is explained in our methodology. Spotted a problem? Let us know.