Boolean Algebra Calculator
Simplify a Boolean expression and follow the laws used in its working. The result includes both sum of products and product of sums, an exact truth table, its complement and a two-input NAND gate list. Use up to eight variables, or 256 rows.
A*B + A*B' + A'*B*C
| A | B | C | out |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
A + B*C
prime implicants- A1 - -
- B*C- 1 1
- Simplified
- A + B*C
- Variables
- 3
- Minterms
- 3,4,5,6,7
- Form
- SOP
A + B*C: 2 terms, 3 literals, proved equal to your expression on all 8 rows.
Minimal: 2 terms and 3 literals, the smallest sum of products there is for this function, proved against every one of the 8 rows.
Your expression
Every step, and the law it used
- ExpansionX = X*Y + X*Y'checked on 8 rows
Every term is grown until it names all 3 variables, which leaves the sum of the 5 rows that are true.
- CombiningX*Y + X*Y' = Xchecked on 8 rows
Round 1: every pair that differs in one variable is merged into a term of 2 literals, which leaves 5 terms in all.
- CombiningX*Y + X*Y' = Xchecked on 8 rows
Round 2: every pair that differs in one variable is merged into a term of 1 literal, which leaves 2 terms in all.
- AbsorptionX + X*Y = Xchecked on 8 rows
Nothing could be dropped: all 2 prime implicants are essential, each covering a row no other one covers.
Complement and NAND logic gates
The complement is true on the rows where your expression is false. This is its minimal sum of products.
Each line below is one two-input NAND gate; tied inputs make a NOT gate. Follow the signals in order to the out line. Constants 0 and 1 are fixed logic levels. This is a gate list, verified against all 8 truth table rows; it is not a claim of the fewest gates or a physical wiring design.
gate1 = NAND(B, C) gate2 = NAND(gate1, gate1) gate3 = NAND(A, A) gate4 = NAND(gate2, gate2) gate5 = NAND(gate3, gate4) out = gate5
Type an expression and the simplification follows. AND, OR, NOT, XOR, NAND, NOR, -> for implies and <-> for if and only if all read the way the table further down lists them, so &&, |, ~, ^, => and <=> arrive at the same place, and a prime after a variable negates it, so A' is NOT A. NOT binds tightest, then AND, then XOR, then OR, then ->, then <->, which is the grouping the truth table generator uses, and the panel prints the reading it used in full brackets. Up to eight variables, which is 256 rows. Answers come back in the same notation, so any form the page gives you can go straight back into the box. Your expression is kept in this browser so the page opens where you left it, and the Start over button at the top of the page forgets it.
NOT binds tightest, then AND and NAND, then XOR and XNOR, then OR and NOR, then ->, then <->. A chain of -> groups to the right, every other chain groups to the left.
Answers are printed with * for AND, + for OR and a trailing ' for NOT, which is notation this page reads, so any form it gives you can go straight back into the box.
The laws it names
| Law | Identity | Where it is used |
|---|---|---|
| Expansion | X = X*Y + X*Y' | grows every term until it names all of the variables, which turns the expression into the sum of the rows that are true |
| Combining | X*Y + X*Y' = X | two terms that differ in one variable lose that variable, which is the whole of the Quine-McCluskey merge |
| Absorption | X + X*Y = X | a term whose rows the kept terms already cover adds nothing, so the covering step drops it |
| Complement | X + X' = 1 and X*X' = 0 | the rows where your expression is false are the rows where its complement is true, which is where a product of sums is worked out |
| De Morgan | (X + Y)' = X'*Y' and (X*Y)' = X' + Y' | turns the simplified complement back the right way round, every product becoming a sum |
What you can type
| Operator | Binds | Also written | True when |
|---|---|---|---|
| NOT | 1 | NOT ! ~ ¬ p' | true when the one side is false |
| AND | 2 | AND && & ∧ * . · | true only when both sides are true |
| NAND | 2 | NAND ↑ | false only when both sides are true |
| XOR | 3 | XOR ^ ⊕ != ≠ | true when the two sides differ |
| XNOR | 3 | XNOR | true when the two sides match |
| OR | 4 | OR || | ∨ + | true when either side is true, or both |
| NOR | 4 | NOR ↓ | true only when both sides are false |
| -> | 5 | -> => → ⇒ ⊃ > IMPLIES | false only when the left side is true and the right side is false |
| <-> | 6 | <-> <=> ↔ ⇔ ≡ = == IFF EQUIV | true when the two sides match |
Common questions
- How do you simplify A + A*B?
- It comes back as A. The page works it the same way it works everything else: A + A*B is true on rows 2 and 3 of a two variable table, so it expands to A*B' + A*B, those two terms differ only in B and merge into A by the combining law X*Y + X*Y' = X, and the covering step finds one prime implicant that covers both true rows. A is then evaluated against all four rows of the original before it is shown. Two neighbours of that question land in the same place: A*(A + B) is also A, and A + A'*B comes back as A + B.
- Is the answer really the smallest expression?
- Inside the search bound, yes, and the page says which of the two you got. Every prime implicant is enumerated by Quine-McCluskey, rows that only one prime can cover make that prime essential, dominated rows and dominated primes are dropped, and what is left is Petrick's selection, expanded as a search that keeps the cheapest cover by term count and then by literal count. For A*B + A*B' + A'*B*C the true rows are 3, 4, 5, 6, 7. There are two prime implicants, A and B*C, both essential, so the answer A + B*C is 2 terms and 3 literals and nothing shorter exists. When a chart is past the bound of 40,000 branches the page returns the canonical form instead, correct and labelled as not minimised.
- What is the difference between sum of products and product of sums?
- They are two shapes of the same function. A sum of products is ORs of ANDs, one term per group of rows that are true: A + B*C. A product of sums is ANDs of ORs, one factor per group of rows that are false: (A + B)*(A + C). Those two are the same eight row table, which the page proves for each of them separately. The product of sums is worked out on the complement, the rows where your expression is false, and then turned round by De Morgan, so the steps for it start with the complement and end with the flip.
- How do I know the simplified expression is right?
- Because the page checks it rather than trusting the rewrite. Every line of the working, and both final forms, are parsed back from the text you can see and evaluated at every row of the table, then compared with the original expression row by row. The panel reports that as proved row by row, 8 of 8 for three variables. A rewrite that did not reproduce the table would not be shown at all: the page would say so and ask for the expression instead, because a smaller expression that is wrong is worse than no simplification.
- How many variables can it handle?
- Eight, which is 256 rows and the whole table drawn, not a sample. A ninth variable is refused by name with the number in the message, 512 rows, rather than being left to lock up the page. Inside eight variables the limit that bites first is the selection chart, not the table: a dense function can have over a hundred prime implicants and a cyclic core that the search cannot finish inside its bound, and then the page returns the canonical sum of products, correct and labelled, instead of a guess.
- Which symbols can it read?
- The words AND, OR, NOT, XOR, NAND, NOR, XNOR, IMPLIES and IFF in any case, and the symbols beside them in the table under the tool: &&, &, * and . for AND, ||, |, + for OR, !, ~ for NOT, ^ for XOR, -> and => for implies, and <->, <=> for if and only if. A prime after a variable or a bracket negates it, so A' is NOT A. NOT binds tightest, then AND, then XOR, then OR, then implies, then the biconditional, and the panel prints the reading it used in full brackets so the grouping is never a guess. It is the notation the truth table generator on this site reads, and the answers come back written the same way.
- Why will it not simplify A XOR B?
- Because A'*B + A*B' really is the smallest sum of products for it. Simplification works by merging rows that differ in one variable, and the two rows where exclusive or is true, 01 and 10, differ in both. Both terms are prime implicants, both are essential, and the covering step drops neither. The page says as much in the working rather than leaving the answer looking like a failure. Exclusive or over three variables behaves the same way and comes back with four terms.
- Does it drop a redundant term?
- Yes, and it names the law that lets it. A*B + A'*C + B*C has three prime implicants, A'*C, A*B and B*C, and the third is the consensus of the other two: every row it covers is already covered, so the covering step drops it by absorption, X + X*Y = X, and the answer is A'*C + A*B. The step that did it says how many prime implicants were essential and how many terms were dropped, and the result is checked against all eight rows like every other line.
- Is my expression sent anywhere?
- No. The parsing, the table, the minimisation and the proof all happen in your browser, there is no account and nothing is uploaded. Your expression and the form you chose are kept in this browser's own storage so the page opens where you left it, and the Start over button at the top of the page forgets them. If your browser blocks storage the tool still works: it opens on the example every time.
- Can I use it for binary or switching algebra?
- Yes. In Boolean or switching algebra each variable has two states, 0 and 1. The table evaluates every combination and the simplifier reduces the Boolean function. Use * or AND between variables and + or OR between terms. The plus sign is OR, so this is Boolean logic rather than ordinary binary-number addition.
- How do I find the complement of my Boolean expression?
- The Complement and NAND logic gates section shows the complement automatically for the expression you entered. Its output is 1 exactly where the original truth table has 0. It is shown as a sum of products, with a canonical-form label if the minimisation reaches the search bound. For A + B the complement is A'*B', which is De Morgan's law.
- Can it convert Boolean algebra to NAND-only logic gates?
- Yes. The gate list uses only two-input NAND gates, with a named signal for each output and an out line for the final result. Connect each later gate to the earlier signals it names; identical inputs invert a signal. Every gate list is evaluated against the original truth table before it is shown. The list describes logical gates, uses fixed 0 or 1 levels for constants and does not optimize the gate count or draw a circuit diagram. The Copy button includes the whole list.
- Can I check whether two Boolean expressions are equivalent?
- Enter the two expressions separated by <-> or =, with parentheses around each expression. These operators compare truth values. A result of 1 on every row proves equivalence; a 0 row shows a combination where the expressions differ. For example, (A + A*B) = A gives the constant 1. The equals sign performs a Boolean comparison; it does not solve for an unknown variable.
The truth table is exact Boolean evaluation of your expression, and every simplification is proved equivalent against that table before it is shown. Minimisation is Quine-McCluskey with Petrick selection inside a bounded search: when an expression is too large for that bound the page returns a correct but unminimised form and tells you which of the two happened, rather than quietly handing you a smaller expression that is wrong.