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: .
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
- From two points: first the slope m = (y₂ − y₁) ÷ (x₂ − x₁), then b = y₁ − m·x₁. If both x-values are equal the line is vertical: x = constant.
- From a point and the slope: plug into b = y₁ − m·x₁ and you are done.
- General form: A·x + B·y + C = 0 with reduced whole numbers. It also works for vertical lines.
- Parametric and normal form: the parametric form uses the direction vector (x₂ − x₁, y₂ − y₁), the normal form the normal vector (A, B), which is perpendicular to the line.
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
- Wikipedia – Linear equation (Normalform y = mx + b, allgemeine Form, Punkt-Steigungs-Form)
- Wikipedia – Slope (slope from two points, angle of inclination)
As of: · Editorial policy
Related tools
- Vector Calculator with StepsVector calculator for 2D and 3D: sum, dot product, cross product, magnitude, angle and projection of two vectors – instant, with the working shown step by step.
- Online graphing calculatorGraphing calculator online: plot up to three functions, zoom and pan, find roots, extrema and intersections, use a slider for a, save as PNG or SVG. Free.
- Quadratic Formula CalculatorQuadratic formula calculator: solve ax² + bx + c = 0 with steps – roots, discriminant, exact radical form, vertex, factored form and complex roots.
- Slope calculatorSlope calculator: find the slope from rise and run, percent, angle or a 1 : n ratio – with conversion to percent and degrees, the working and a table of values.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- Lakh to Million and Crore to Million / Billion ConverterLakh to million converter: change lakh and crore into million, billion and trillion or back, with Indian commas (1,00,000), the number in words and a table.
- Synchronous speed calculator: motor rpm, slip and loadSynchronous speed calculator for AC motors: 120 × frequency ÷ poles, slip in rpm and percent from the measured speed, and load estimate by the DOE slip method.
- Pneumatic cylinder force calculator with load factor and air consumptionPneumatic cylinder force calculator: extend and retract force from bore, rod and pressure, usable load with SMC load factor, minimum bore and air consumption.
- SGPA to CGPA CalculatorSGPA to CGPA calculator: enter each semester’s SGPA and credits and get your CGPA by the UGC formula, rounded to two decimals, with every step of the working.