Linear Equation Calculator

Solve any linear equation in one variable — type the whole equation or enter the coefficients, and get the exact answer with every step and a check.

Solve the linear equation

Type the whole equation as it is written, or enter the coefficients of ax + b = cx + d. Fractions, decimals and parentheses all work — and the answer is checked by putting x back into both sides.

Type it the way it is written: 3(x + 2) = 3x + 6, x/3 + x/6 = 2, 20 − 7x = 6x − 6 — fractions, decimals and parentheses are all fine.

Try one:
2x + 3 = 7
x = 2.
One solution — x = 2
Exact answer (fraction)2
Decimal2
Mixed number—
Left side with x put back7
Right side with x put back7
Check7 = 7

Step-by-step working

  1. Start with the equation: 2x + 3 = 7.
  2. Move the x terms to the left and the numbers to the right: (2 − 0)x = 7 − 3.
  3. Simplify: 2x = 4.
  4. Divide both sides by 2: x = 4 ÷ 2 = 2.
  5. Check by substituting x = 2 back in: left side = 7, right side = 7. Both sides match, so the answer is correct.

What Is a Linear Equation?

A linear equation in one variable is an equation where x appears only to the first power — never squared, never under a square root, never in a denominator, and never multiplied by another x. It can always be rearranged into the form ax + b = cx + d, where a, b, c and d are plain numbers. The word "linear" comes from "line": if you plot the left side as y = ax + b and the right side as y = cx + d, you get two straight lines, and the solution is the x-value where the two lines cross. That picture is worth keeping in mind, because it explains the three possible outcomes at a glance: the lines cross once (one solution), they are the same line (every number is a solution), or they are parallel and never meet (no solution).

Linear equations are the first kind of equation most people meet in school, and they never really go away. A phone bill that charges a monthly fee plus a per-minute rate, a taxi fare with a starting fee plus a per-mile charge, the time it takes to fill a tank at a steady rate — all of these are linear equations in disguise. The unknown is usually a quantity you want to find: how many minutes you talked, how many miles you rode, how long the tank takes to fill. Solving the equation is just undoing the arithmetic, one careful step at a time, and this calculator shows every step so you can follow along or check your homework.

How to Solve a Linear Equation Step by Step

Every linear equation is solved the same way, no matter how messy it looks at first. The golden rule is: whatever you do to one side, do exactly the same to the other side. That keeps the two sides equal at every step, so the answer at the end is the answer to the equation you started with. Here is the method this calculator follows:

ax + b = cx + d  →  (a − c)x = d − b  →  x = (d − b) / (a − c)

Step 1 — Simplify each side. Multiply out any parentheses and combine like terms on each side separately. For 2(x + 3) − x/2 = x + 9, the left side becomes 2x + 6 − x/2 = 3x/2 + 6. Nothing has moved across the equals sign yet; each side is just tidied up.

Step 2 — Move the x terms to one side. Add or subtract the same x term on both sides so that all the x's end up together. It does not matter which side you choose, but picking the side where the x coefficient ends up positive keeps the arithmetic friendlier. For 20 − 7x = 6x − 6, adding 7x to both sides gives 20 = 13x − 6.

Step 3 — Move the numbers to the other side. Now add or subtract the same number on both sides so that the x term stands alone with a number on the other side. Continuing the example: add 6 to both sides and you get 26 = 13x.

Step 4 — Divide by the coefficient of x. Divide both sides by the number in front of x. Here 26 / 13 = 2, so x = 2. If the answer is a fraction, leave it as a fraction — it is exact, while a decimal may be rounded. This calculator shows the exact fraction, the decimal and the mixed number together.

Step 5 — Check by substitution. Put the answer back into the original equation and work out both sides. If they match, the answer is right. For 20 − 7(2) = 6 and 6(2) − 6 = 6: both sides are 6, so x = 2 is correct. Skipping the check is how sign errors survive to the end of a homework set — this calculator does the check for you and shows it under the answer.

Worked Examples

Example 1 — A two-step equation

Solve 2x + 3 = 7.

Step 1: Subtract 3 from both sides: 2x = 4.
Step 2: Divide both sides by 2: x = 2.
Step 3: Check: 2(2) + 3 = 7 ✓.

Example 2 — x on both sides

Solve 5x − 3 = 2x + 9.

Step 1: Subtract 2x from both sides: 3x − 3 = 9.
Step 2: Add 3 to both sides: 3x = 12.
Step 3: Divide by 3: x = 4.
Step 4: Check: 5(4) − 3 = 17 and 2(4) + 9 = 17 ✓.

Example 3 — Fractions

Solve x/3 + x/6 = 2.

Step 1: Combine the x terms: x/3 + x/6 = x/2, so x/2 = 2.
Step 2: Multiply both sides by 2: x = 4.
Step 3: Shortcut: multiply everything by 6 first (the least common denominator) to get 2x + x = 12, then 3x = 12, x = 4 — the same answer without fractions in the middle.
Step 4: Check: 4/3 + 4/6 = 4/3 + 2/3 = 2 ✓.

Example 4 — Parentheses and a fraction answer

Solve 3x = 10.

Step 1: Divide both sides by 3: x = 10/3, which is 3 1/3 or about 3.333.
Step 2: Check: 3 × (10/3) = 10 ✓. The fraction 10/3 is exact; the decimal 3.333 is rounded, which is why the calculator keeps the fraction front and centre.

Example 5 — A word problem

A phone plan costs $15 a month plus $0.10 a minute, and the bill was $27.50. How many minutes were used?

Step 1: Let m be the minutes: 15 + 0.10m = 27.50.
Step 2: Subtract 15 from both sides: 0.10m = 12.50.
Step 3: Divide by 0.10: m = 125 minutes.
Step 4: Check: 15 + 0.10 × 125 = 15 + 12.50 = 27.50 ✓.

When There Is No Solution — or Every Number Works

Most linear equations have exactly one solution, but two special cases are worth knowing, because they look like ordinary equations until you try to solve them. No solution happens when the x terms cancel out but the numbers do not: 3(x + 2) = 3x + 5 becomes 3x + 6 = 3x + 5, and subtracting 3x from both sides leaves 6 = 5, which is false. No value of x can fix that, so the equation has no solution. On a graph, the two sides are parallel lines that never cross. Every number is a solution happens when the two sides are identical: 3(x + 2) = 3x + 6 becomes 3x + 6 = 3x + 6, which is true for x = 0, x = 1, x = −5 — for any number at all. On a graph, the two sides are the same line. Both cases come from the same test: after moving the terms together you get (a − c)x = d − b. If a − c is 0 and d − b is not 0, there is no solution; if both are 0, every number works. This calculator detects both cases and explains them instead of dividing by zero or inventing an answer.

Fractions, Decimals and Parentheses

Real equations are rarely as tidy as 2x + 3 = 7. Fractions appear whenever a quantity is shared — x/3 means one third of x — and the cleanest way to handle them is to multiply both sides by the least common denominator so the fractions disappear before the real work starts. Decimals like 0.25x are the same idea in different clothes: 0.25x = 3 is just x/4 = 3, so x = 12. Multiplying by 100 clears two decimal places, just as multiplying by the denominator clears a fraction. Parentheses mean "multiply everything inside": 3(x + 2) is 3x + 6, and a minus sign in front of parentheses flips every sign inside, so −(x − 4) is −x + 4, not −x − 4. Forgetting that flip is one of the most common errors in algebra. This calculator accepts all three — fractions, decimals and parentheses — in one typed equation, and it keeps the arithmetic exact by working with fractions internally, so 1/3 stays 1/3 instead of becoming 0.333.

Linear Equations in Real Life

Linear equations are the maths of steady rates. A taxi fare is a starting fee plus a per-mile rate: $3 + $2.50 per mile, and a $23 fare means 3 + 2.50m = 23, so m = 8 miles. A phone plan is a monthly fee plus a per-minute rate, as in the example above. Temperature conversion is linear: Fahrenheit = 1.8 × Celsius + 32, so finding the Celsius value for 68°F is the equation 1.8C + 32 = 68, giving C = 20. Mixing and diluting — how much water to add to a solution, how much of each ingredient to use — is linear. Even break-even analysis in a small business is a linear equation: revenue and cost are both straight lines in the number of units sold, and the break-even point is where the two lines cross, exactly the picture from the start of this page. Whenever something changes at a steady rate, a linear equation is hiding in the numbers.

Common Linear Equation Mistakes to Avoid

The most common mistake is a sign error when moving a term across the equals sign: a term that moves changes its sign, so +3 becomes −3 on the other side. Writing each move as "add 3 to both sides" instead of "move the 3 over" makes the sign change visible and prevents the slip. Second, dividing only part of an equation: when you divide by 3, divide every term on both sides, not just the x term — 3x + 6 = 12 becomes x + 2 = 4, not x + 6 = 4. Third, forgetting to distribute to every term inside parentheses: 2(x + 3) is 2x + 6, not 2x + 3. Fourth, dropping the minus when a negative multiplies parentheses: −(x − 4) is −x + 4. Fifth, rounding a fraction too early: keep 10/3 as a fraction until the final step, or the check at the end will not quite balance. And sixth, calling "no solution" a failure: an equation with no solution is a perfectly good answer — it tells you the situation described cannot happen, like two phone plans that never cost the same. The calculator's check step catches the first five of these automatically, because a wrong move makes the two sides disagree at the end.

My saved numbers reuse them in any calculator

Save a number once — like your rent or hourly rate — then just type its name instead of the number, in any calculator here. You can also type formulas like 5000 * 1.1 right into any box.

    Saved only in this browser — nothing is sent to us.

    Frequently Asked Questions

    What is a linear equation?

    A linear equation in one variable is an equation where x appears only to the first power — never squared, never under a root, never in a denominator. It can always be written as ax + b = cx + d. Its graph is a straight line, and its solution is the single x-value that makes both sides equal.

    How do you solve a linear equation step by step?

    First simplify each side: multiply out any parentheses and combine like terms. Then move all the x terms to one side and all the numbers to the other, giving (a − c)x = d − b. Finally divide both sides by (a − c): x = (d − b) / (a − c). For 2x + 3 = 7: 2x = 4, so x = 2. Always check by putting x back into the original equation.

    What does it mean when a linear equation has no solution?

    It means no value of x can make the equation true. It happens when the x terms cancel but the numbers do not: 3(x + 2) = 3x + 5 simplifies to 3x + 6 = 3x + 5, then to 0 = 1, which is false. Geometrically the two sides are parallel lines that never meet. This calculator says "No solution" instead of guessing a number.

    What does it mean when every number is a solution?

    It means the two sides are the same expression in disguise, so any x works. For example 3(x + 2) = 3x + 6 simplifies to 3x + 6 = 3x + 6 — pick x = 0, x = 1 or x = −5 and both sides always match. This is called an identity, and the calculator reports "Every number is a solution".

    How do you solve a linear equation with fractions?

    Work with the fractions exactly instead of rounding them. For x/3 + x/6 = 2, combine the x terms: x/3 + x/6 = x/2, so x/2 = 2 and x = 4. A handy shortcut is to multiply both sides by the least common denominator first (here 6): 2x + x = 12, so 3x = 12 and x = 4. This calculator keeps fractions exact all the way through.

    How do you solve a linear equation with x on both sides?

    Move the x terms together first. For 20 − 7x = 6x − 6, add 7x to both sides to get 20 = 13x − 6, then add 6: 26 = 13x, then divide by 13: x = 2. The rule is the same as always — do the same thing to both sides — you just have an x term to move as well as a number.

    Related Calculators

    Last reviewed: November 26, 2026 · Formulas verified for accuracy.