What this calculator does
The Line Equation from Two Points Calculator finds the straight line that passes through any two points in the coordinate plane. Enter the coordinates of point one (x₁, y₁) and point two (x₂, y₂), and the tool returns the slope, the y-intercept, the full slope-intercept equation \(y = mx + b\), and the straight-line distance between the points.
How to use it
Type the four coordinate values into the boxes and submit. The calculator first computes the slope, then uses the point-slope relationship to derive the y-intercept and produce the final equation. If the two x-values are equal, the line is vertical and is written as x = constant because its slope is undefined.
The formula explained
The slope m is the change in y divided by the change in x: \(m = (\text{y}_2 - \text{y}_1) / (\text{x}_2 - \text{x}_1)\). This measures steepness — how much y rises for each unit increase in x. Once you have m, the point-slope form \(y - \text{y}_1 = m(x - \text{x}_1)\) describes the line. Expanding it gives the slope-intercept form $$y = mx + b$$ where the intercept \(b = \text{y}_1 - m\cdot\text{x}_1\) is the value of y where the line crosses the vertical axis.
Worked example
For the points (1, 2) and (3, 6): slope $$m = \frac{6 - 2}{3 - 1} = \frac{4}{2} = 2.$$ The intercept \(b = 2 - 2\cdot1 = 0\), so the equation is \(y = 2x\). The distance between the points is $$\sqrt{(3-1)^2 + (6-2)^2} = \sqrt{4 + 16} = \sqrt{20} \approx 4.472.$$
FAQ
What if both points have the same x? The line is vertical, slope is undefined, and the equation is written \(x = \text{x}_1\).
What if both points have the same y? The line is horizontal with slope 0, giving \(y = \text{y}_1\).
Can I use negative or decimal coordinates? Yes — any real numbers are accepted, including negatives and decimals.