Equation of a Line Calculator

This equation of a line calculator turns two points, or one point and a slope, into the equation y = mx + b in seconds. It also gives the x-intercept, the general form, the parametric form and the normal form, and the working shows every step with your own numbers.

Example: You know: two points · Point 1 – x₁ 1 · Point 1 – y₁ 2 · Point 2 – x₂ 4 · Point 2 – y₂ 8 → Equation of the line: y = 2x. Source: Wikipedia – Linear equation (Normalform y = mx + b, allgemeine Form, Punkt-Steigungs-Form). Updated: .

Leave empty if you do not need a function value
My ToolboxYour inputs are saved in this browser only.

Result

Equation of the line
y = 2x
Slope
2 (angle of inclination 63.4349°)
y-intercept
0 – crosses the y-axis at (0, 0)
x-intercept
0 – crosses the x-axis at (0, 0)
General form
2x − y = 0
Parametric form
x⃗ = (1, 2) + t · (3, 6)
Normal form
(2, −1) · [x⃗ − (1, 2)] = 0
The two points
Distance between the points: 3√5 ≈ 6.7082 · midpoint: (2.5, 5)
Working
  • m = (y₂ − y₁) ÷ (x₂ − x₁) = (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2
  • n = y₁ − m · x₁ = 2 − 2 · 1 = 0
  • Equation of the line: y = 2x
  • General form (integers, reduced): 2x − y = 0

How it is calculated

A line in the plane is usually written as y = mx + b, with slope m and y-intercept b. The slope is the rise per step to the right, and b is where the line crosses the y-axis. For the points (1, 2) and (4, 8), m = (8 − 2) ÷ (4 − 1) = 2 and b = 2 − 2·1 = 0, so y = 2x.

Ways to find the equation

x-intercept, angle and checking

The x-intercept is where the line crosses the x-axis (y = 0), so x = −b ÷ m. The angle of inclination follows from α = arctan(m). To check, substitute both points into the equation; they must satisfy it. The “y-value at x” field gives you further points. For direction vectors, angles and dot products use the vector calculator, for the zeros of a parabola the quadratic formula calculator, and to draw the graph the graphing calculator.

Frequently asked questions

How do I find the equation of a line from two points?

Calculate the slope m = (y₂ − y₁) ÷ (x₂ − x₁), then b = y₁ − m·x₁. For (1, 2) and (4, 8) that gives m = 2, b = 0 and the equation y = 2x.

What is the equation of a line from a point and slope?

From m and a point (x₁, y₁), b = y₁ − m·x₁ and the equation is y = mx + b. For m = 0.5 and (2, 3), b = 2, so y = 0.5x + 2.

What is the general form of a line?

A·x + B·y + C = 0 with whole numbers A, B and C. y = 2x becomes 2x − y = 0. This form can also describe vertical lines such as x = 3 (x − 3 = 0).

How do I find the x-intercept of a line?

Set y = 0 and solve for x: x = −b ÷ m. For y = 2x − 4 the x-intercept is x = 2.

What does it mean when both x-values are equal?

The line is vertical and has no slope. Its equation is simply x = constant; there is no form y = mx + b.

Sources and legal basis

As of: · Editorial policy

Related tools