Line Equation Calculator
Find the equation of a straight line through two points. Returns slope, y-intercept, slope-intercept form and standard form.
Last reviewed by the Radiatus Cloud team
Find the equation of the line through two points, in slope-intercept and standard form.
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Find the equation of a line
Two distinct points determine a unique straight line, and this calculator finds its equation. It first computes the slope, the change in y divided by the change in x between the points, then the y-intercept, the value of y where the line crosses the vertical axis. From these it writes the line in slope-intercept form, y equals m x plus b, as well as point-slope form and standard form.
Special cases are handled: if the two points share the same x coordinate the line is vertical, with an undefined slope and an equation of the form x equals a constant, which the tool reports instead of dividing by zero.
Using line equations
The equation of a line is a cornerstone of algebra and coordinate geometry. Students use it to graph lines, find intersections and model linear relationships. Scientists and analysts fit straight lines to data to describe trends, and engineers use slopes to express gradients and rates of change.
Slope-intercept form is the most common because it reads off the steepness and starting height directly. Point-slope form is convenient when you know a point and the slope, and standard form is useful for certain algebraic manipulations. All calculation runs locally in your browser.
Related tools
- Percentage Calculator — Calculate percentages, percentage change, increase and decrease, and reverse percentages, with the working shown for each result.
- Statistical Calculator — Calculate mean, median, mode, standard deviation, and more.
- Probability Calculator — Calculate probabilities for single and combined events, including conditional probability and Bayes' theorem.
- Scientific Calculator — Perform advanced mathematical operations including trig, log, and exponents.
Frequently Asked Questions
How is the slope calculated?
The slope is the difference in the y coordinates divided by the difference in the x coordinates, often described as rise over run.
What is the y-intercept?
It is the y value where the line crosses the vertical axis, found by substituting a point and the slope into y equals m x plus b and solving for b.
What if my points form a vertical line?
A vertical line has an undefined slope. The tool detects equal x coordinates and reports the equation as x equals a constant.
What is the difference between the forms?
Slope-intercept form shows slope and intercept directly, point-slope form uses a known point and the slope, and standard form arranges the equation with the variables on one side.
Can the points have decimals or negatives?
Yes. Any distinct real points work, and the resulting slope and intercept may themselves be decimals.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Enter two points and the tool derives the line equation and slope.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.
Related Tools
Percentage Calculator
MathCalculate percentages, percentage change, increase and decrease, and reverse percentages, with the working shown for each result.
Statistical Calculator
MathCalculate mean, median, mode, standard deviation, and more.
Probability Calculator
MathCalculate probabilities for single and combined events, including conditional probability and Bayes' theorem.