Connect via MCP →

Enter Calculation

Formula

Show calculation steps (1)
  1. Distance Between Points

    Distance Between Points: Line Equation from Two Points Calculator

    Euclidean distance between the two points

Advertisement

Results

Slope-Intercept Equation
y = 2x + 0
line through the two points
Slope (m) 2
Y-intercept (b) 0
Distance between points 4.472136

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.

Two points on a coordinate plane connected by a line showing rise and run
Slope is the rise over the run between the two points.

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.$$

Line crossing the y-axis showing slope and y-intercept
The line's y-intercept is where it crosses the vertical axis.

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.

Last updated: