Category

Line Equation from Two Points Calculator — Slope-Intercept, Standard & 3D Forms

Find the equation of a line passing through any two points. Get slope-intercept form (y = mx + b), standard form (Ax + By + C = 0), and 3D parametric & symmetric equations. Supports metric (m, km, cm, mm) and US/Imperial (ft, in, mi, yd) coordinate units.

0 calculations

Calculation Parameters

xcalcugo_lineequation_point_1

xcalcugo_lineequation_point_2

Enter Parameters

Fill in the form on the left and click "Calculate"

Line Equation from Two Points Calculator

This calculator finds the equation of a line passing through two given points in 2D or 3D space. Enter the coordinates of both points and instantly get the slope-intercept form, standard form, distance between the points, and the angle the line makes with the x-axis. Switch to 3D mode to get parametric and symmetric equations.

How to Use This Calculator

  1. Choose 2D or 3D mode using the dimension selector at the top of the form.
  2. Optionally select a unit system (Metric or Imperial) if you want distance results labeled with units.
  3. Enter the x and y coordinates (and z in 3D mode) for Point 1 and Point 2.
  4. Click Calculate to get results instantly.

The calculator outputs:

  • 2D: Slope (m), y-intercept (b), slope-intercept form (y = mx + b), standard form (Ax + By + C = 0), distance between points, and angle with x-axis.
  • 3D: Direction vector, parametric equations, symmetric form (when applicable), and distance between points.

What Is the Line Equation from Two Points?

A straight line in a plane is fully determined by any two distinct points that lie on it. Given two points P₁ = (x₁, y₁) and P₂ = (x₂, y₂), there is exactly one line passing through both. The equation of this line can be expressed in several equivalent forms.

Slope-Intercept Form: y = mx + b

This is the most common form. Here, m is the slope and b is the y-intercept (the value of y when x = 0).

m = (y₂ − y₁) / (x₂ − x₁)
b = y₁ − m · x₁

Example (2D):

Points: P₁ = (1, 2) and P₂ = (4, 8)

  • Slope: m = (8 − 2) / (4 − 1) = 6 / 3 = 2
  • Y-intercept: b = 2 − 2·1 = 0
  • Equation: y = 2x
  • Standard form: 2x − y = 0
  • Distance: √((4−1)² + (8−2)²) = √(9 + 36) = √45 ≈ 6.708

Standard Form: Ax + By + C = 0

The standard form is useful in linear algebra and analytic geometry. It is derived from the slope-intercept form by clearing fractions and rearranging terms. The calculator automatically simplifies A, B, and C using their greatest common divisor (GCD) and ensures A is positive.

Special Cases

Case Condition Result
Vertical line x₁ = x₂ Slope is undefined. Equation: x = c
Horizontal line y₁ = y₂ Slope = 0. Equation: y = c
Diagonal line x₁ ≠ x₂, y₁ ≠ y₂ Full y = mx + b form

3D Line Equation from Two Points

In three-dimensional space, a line cannot be described by a single equation. Instead, it is represented using parametric or symmetric equations.

Parametric Form

Given two 3D points P₁ = (x₁, y₁, z₁) and P₂ = (x₂, y₂, z₂), the direction vector is d = (dx, dy, dz) where dx = x₂ − x₁, dy = y₂ − y₁, dz = z₂ − z₁.

x = x₁ + t·dx
y = y₁ + t·dy
z = z₁ + t·dz

Here, t is a free parameter. When t = 0, you are at P₁; when t = 1, you are at P₂. All other values of t give other points on the line.

Symmetric Form

When none of the direction vector components are zero, the parametric equations can be combined into the symmetric form:

(x − x₁) / dx = (y − y₁) / dy = (z − z₁) / dz

If any component of the direction vector is zero (e.g., dz = 0, meaning the line lies in a plane parallel to the xy-plane), the symmetric form does not apply for that component. In such cases, only the parametric form is shown.

Example (3D):

Points: P₁ = (1, 2, 3) and P₂ = (4, 6, 9)

  • Direction vector: d = (3, 4, 6)
  • Parametric: x = 1 + 3t, y = 2 + 4t, z = 3 + 6t
  • Symmetric: (x − 1)/3 = (y − 2)/4 = (z − 3)/6
  • Distance: √(3² + 4² + 6²) = √(9 + 16 + 36) = √61 ≈ 7.81

Distance Between Two Points

The distance formula is derived from the Pythagorean theorem:

d = √((x₂ − x₁)² + (y₂ − y₁)²)  (2D)
d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)  (3D)

If you select a unit system, the distance will be displayed with the chosen unit label (e.g., meters, feet).

Angle with the X-Axis

The angle θ that the line makes with the positive x-axis is given by:

θ = arctan(m) in degrees

A horizontal line has θ = 0°. A line with slope 1 makes a 45° angle. A line with a very steep positive slope approaches 90°.

Step-by-Step Example

Find the equation of the line through (−2, 5) and (3, −1):

  1. Compute slope: m = (−1 − 5) / (3 − (−2)) = −6 / 5 = −1.2
  2. Compute y-intercept: b = 5 − (−1.2)(−2) = 5 − 2.4 = 2.6
  3. Slope-intercept form: y = −1.2x + 2.6
  4. Standard form: Multiply through by 5: −6x − 5y + 13 = 0, or 6x + 5y − 13 = 0
  5. Distance: √((3−(−2))² + (−1−5)²) = √(25 + 36) = √61 ≈ 7.81
  6. Angle: arctan(−1.2) ≈ −50.19°
Tip: Sharing Results

After calculating, you can use the Share button to generate a unique link that saves your input values. Share it with a student, colleague, or paste it into notes — the calculator will reload with the same inputs.

Frequently Asked Questions

What is the slope-intercept form?

The slope-intercept form is y = mx + b, where m is the slope (steepness) and b is the y-intercept (where the line crosses the y-axis). It is the most intuitive way to describe a non-vertical line in 2D.

What is the standard form of a line equation?

The standard form is Ax + By + C = 0, where A, B, and C are integers (or real numbers). It is particularly useful in systems of linear equations and matrix algebra. This calculator automatically simplifies the coefficients using GCD.

What happens when both points are the same?

Two identical points do not define a unique line — infinitely many lines pass through a single point. The calculator will return an error if you enter two identical points.

How is the 3D line equation different from 2D?

In 2D, a line is defined by a single linear equation. In 3D, a line requires either two simultaneous plane equations, or — more practically — parametric equations with a direction vector and a point. This calculator uses the parametric and symmetric forms for 3D lines.

What is the direction vector?

The direction vector d = (dx, dy, dz) points along the line and tells you how much x, y, and z change per unit of the parameter t. It is simply P₂ − P₁.

Can this calculator handle decimal or negative coordinates?

Yes. You can enter any real number — positive, negative, integer, or decimal — for any coordinate. The calculator handles all cases accurately.

Important Note

This calculator provides pure mathematical results with no rounding until the final display (up to 6 decimal places, trailing zeros removed). For surveying, engineering, or construction applications, always verify results with professional tools and consult qualified engineers.

Calculation History

Loading...