Free Line Equation from Two Points Calculator

Enter Points

First Point

Second Point

Enter the coordinates of two points to calculate the equation of the line passing through them.

Finding the Line Equation from Two Points

This calculator offers a fast and accurate way to derive the linear equation from two points in either 2D or 3D space. It supports multiple output formats—slope intercept form, standard form, two point form, and for three‑dimensional problems, a parametric representation. Whether you need to find line equation for homework, engineering analysis, or geometry, this free online tool provides the result instantly after you enter the coordinates of the two points.

Mathematical Derivation of the Line

The procedures described below are the same ones the calculator follows internally.

Slope‑Intercept Form

The most familiar form for a straight line in a plane is y=mx+by = m x + b, where mm is the slope and bb is the yy-intercept. Given two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) with distinct xx-coordinates, the slope is computed as

m=y2−y1x2−x1.m = \frac{y_2 - y_1}{x_2 - x_1}.

This is the “rise over run” ratio: vertical change divided by horizontal change. After obtaining the slope, the intercept is found by solving b=y1−m x1b = y_1 - m\,x_1 (using either point). The full equation becomes:

y=mx+b.y = m x + b.

If the two points have the same xx-coordinate, the slope is undefined and the line is vertical. In that case the equation is x=x1x = x_1. The calculator automatically detects this situation and reports the vertical line accordingly.

Standard Form and Two-Point Form

The standard linear equation is written as

Ax+By+C=0,A x + B y + C = 0,

with the coefficients derived from the points:

A=y2−y1,B=x1−x2,C=y1(x2−x1)−(y2−y1)x1.\begin{aligned} A &= y_2 - y_1, \\ B &= x_1 - x_2, \\ C &= y_1(x_2 - x_1) - (y_2 - y_1)x_1. \end{aligned}

The same vertical line condition yields B=0B = 0 and an equation of the form Ax+C=0A x + C = 0. When the points are horizontal (equal yy-coordinates), the slope is zero and the slope‑intercept form reduces to y=constanty = \text{constant}; the standard form reflects that as well.

The two‑point form (a special case of the point‑slope form) keeps the original coordinates explicit:

y−y1=y2−y1x2−x1 (x−x1).y - y_1 = \frac{y_2 - y_1}{x_2 - x_1}\,(x - x_1).

This form is especially helpful when you want to see how the line relates directly to the given points without extra algebra.

Worked Example

Take P(2,3)P(2,3) and Q(5,11)Q(5,11):

  • Slope: m=11−35−2=83m = \frac{11-3}{5-2} = \frac{8}{3}.
  • Intercept: b=3−83⋅2=−73b = 3 - \frac{8}{3}\cdot 2 = -\frac{7}{3}.
  • Slope‑intercept: y=83x−73y = \frac{8}{3}x - \frac{7}{3}.
  • Standard form: A=8A = 8, B=−3B = -3, C=−7C = -7; hence 8x−3y−7=08x - 3y - 7 = 0.
  • Two‑point form: y−3=83(x−2)y - 3 = \frac{8}{3}(x - 2).

All describe the same line. The calculator can produce any of these forms on demand.

Line Equation in Three Dimensions

In 3D a line through points (x1,y1,z1)(x_1, y_1, z_1) and (x2,y2,z2)(x_2, y_2, z_2) is expressed parametrically. Let the direction vector be

v=(x2−x1,  y2−y1,  z2−z1).\mathbf{v} = (x_2 - x_1,\; y_2 - y_1,\; z_2 - z_1).

Then the line is given by

r(t)=v t+r1,\mathbf{r}(t) = \mathbf{v}\,t + \mathbf{r}_1,

with r1=(x1,y1,z1)\mathbf{r}_1 = (x_1, y_1, z_1) and tt a real parameter. The component equations are:

{x=(x2−x1) t+x1,y=(y2−y1) t+y1,z=(z2−z1) t+z1.\begin{cases} x = (x_2 - x_1)\,t + x_1,\\ y = (y_2 - y_1)\,t + y_1,\\ z = (z_2 - z_1)\,t + z_1. \end{cases}

When t=0t = 0 the point is (x1,y1,z1)(x_1, y_1, z_1); when t=1t = 1 it is (x2,y2,z2)(x_2, y_2, z_2). This parametric description is the standard way to represent lines in three‑dimensional geometry and physics.

Using the Calculator

The interface is designed for simplicity:

  1. Select dimension – choose “2D” or “3D” from the mode selector.
  2. Enter coordinates – type the numbers for the first and second points into the labelled fields.
  3. Get the result – press the calculate button. The tool immediately displays:
    • In 2D mode: both the slope‑intercept form and the standard form.
    • In 3D mode: the parametric vector equation and the system of component equations.
  4. Adjust precision – use the “Precision” dropdown to set the number of decimal places (for non‑integer results).

The calculator handles special cases gracefully: vertical lines (2D) are shown as x=x1x = x_1, and if the two points coincide it issues a warning. All fractions are simplified automatically. This free line equation from two points calculator gives you the exact equation in seconds, ready to copy or use in further work.

FAQ

1. How does the calculator find the slope-intercept form from two points?

It calculates the slope m = (y2 - y1)/(x2 - x1) and the intercept b = y1 - m*x1, then forms the equation y = m x + b.

2. What does the calculator output for a vertical line?

For a vertical line (x1 = x2), the slope is undefined, so the calculator displays the equation x = x1 (or its standard form equivalent) instead of a slope-intercept form.

3. Can I use the calculator for three-dimensional points?

Yes, the calculator has a 3D mode that produces the parametric equation r(t) = v t + r1, along with the component equations for x, y, and z.

4. What is the two-point form formula used by the calculator?

The two-point form is y - y1 = (y2 - y1)/(x2 - x1)*(x - x1). It uses both point coordinates directly.

5. Is this tool free to use?

Yes, the line equation from two points calculator is completely free, with no registration or payment required.

How to Use

  1. Enter the x and y coordinates of the first point (x₁, y₁) in the input fields.
  2. Enter the x and y coordinates of the second point (x₂, y₂) in the input fields.
  3. The calculator automatically computes the slope-intercept form and standard form equations of the line passing through both points.