Boolean Algebra Calculator
Type any boolean expression and get the minimized form, full truth table, canonical SOP/POS, a Karnaugh map, and an auto-generated logic gate diagram — all in one step.
What this Boolean algebra calculator does
Boolean algebra is the branch of algebra where every variable holds one of just two values — true or false, 1 or 0 — combined using AND, OR, NOT, and XOR instead of addition and multiplication. It's the math underneath every digital logic circuit, every conditional statement in code, every search query filter, and every database WHERE clause. This calculator takes any expression you type, works out exactly which input combinations make it true, and reduces it to the smallest equivalent form using the same method taught in discrete mathematics and digital logic courses.
Rather than only returning a single simplified line, it builds out the full picture: the complete truth table, the canonical sum-of-products and product-of-sums forms, a Karnaugh map for visual learners, and a generated logic gate diagram showing how the expression would look as an actual circuit.
Supported syntax and operator precedence
Variables are single letters A through F. Operators can be typed as symbols or as words, and the calculator normalizes either form automatically.
| Operation | Accepted Symbols | Example | Meaning |
|---|---|---|---|
| NOT | ! ~ ¬ ' or the word NOT | A' or !A | "Not A" |
| AND | · * . & or the word AND, or no symbol at all | A·B or AB | "A and B" |
| XOR | ^ ⊕ or the word XOR | A^B | "A or B, but not both" |
| OR | + | or the word OR | A+B | "A or B" |
Precedence, from highest to lowest, is NOT, then AND, then XOR, then OR — the same
order used by most programming languages. So A + B·C' is parsed as
A + (B·(C')). Parentheses always override this order and are the safest
way to write an expression exactly the way you intend it.
How the Quine–McCluskey simplification works
Once your expression is parsed, the calculator evaluates it for every possible combination of its variables to find the minterms — the specific input rows where the result is true. From there it applies the Quine–McCluskey method, a tabular alternative to manually juggling De Morgan's theorem, the distributive law, and the absorption law by hand:
1. Group and combine
Minterms are repeatedly merged with any other minterm that differs in exactly one variable, replacing that variable's position with a dash. This continues until no further merges are possible, leaving a set of prime implicants.
2. Find essential terms
Any prime implicant that is the only one covering a particular true row is essential and must appear in the final expression — dropping it would make that row impossible to reach.
3. Cover what's left
Any true rows not yet covered by an essential term are covered by adding the fewest remaining prime implicants needed, producing a minimal or near-minimal sum-of-products expression.
4. Convert back to literals
Each surviving term is translated back into variables: a 1 in a position keeps the variable, a 0 complements it, and a dash drops that variable from the term entirely.
Worked example: (A + B)(A + C)
This expression has 3 variables and is a textbook case for the distributive law. Its truth table comes out true for every row where A is true, and also for the row where A is false but B and C are both true — six of the eight possible combinations. Algebraically:
(A + B)(A + C) = A + BC
Distributing the left side gives AA + AC + AB + BC. Since AA = A (the idempotent law) and A + AC = A and A + AB = A (the absorption law), everything collapses down to A + BC — three literals instead of the original four, and one fewer gate in the equivalent circuit. The calculator's Quine–McCluskey result for this input matches this exactly, and its logic gate diagram visually shows the reduction from four gates down to two.
Boolean algebra laws reference
These are the identities the Quine–McCluskey method is effectively applying under the hood, useful as a quick reference whenever you want to simplify an expression by hand instead:
| Law | AND Form | OR Form |
|---|---|---|
| Identity | A·1 = A | A+0 = A |
| Null (dominant) | A·0 = 0 | A+1 = 1 |
| Idempotent | A·A = A | A+A = A |
| Complement | A·A' = 0 | A+A' = 1 |
| Double negation | (A')' = A | |
| Commutative | A·B = B·A | A+B = B+A |
| Associative | (A·B)·C = A·(B·C) | (A+B)+C = A+(B+C) |
| Distributive | A·(B+C) = AB+AC | A+(B·C) = (A+B)(A+C) |
| Absorption | A·(A+B) = A | A+(A·B) = A |
| De Morgan's | (A·B)' = A'+B' | (A+B)' = A'·B' |
Related math tools
Every row of a truth table is really just a number written in binary — row 5 of a 3-variable table, for instance, is the bit pattern 101. If you want to flip back and forth between that kind of binary minterm index and decimal, hex, or another base, the number base converter handles the conversion directly. The truth table above also shows you what percentage of input rows come out true — if you want to take that figure further, the percentage calculator can help with any follow-up percentage math, like comparing true-row ratios across two different expressions.
The Quine–McCluskey method's grouping step is really a counting problem in disguise: deciding how many ways a given number of literals can be dropped from a term is the same kind of "n choose k" counting that shows up across combinatorics. The Pascal's triangle calculator is a quick way to see those binomial coefficients directly if you're curious how many prime implicants a given variable count can theoretically produce.
Boolean algebra calculator — FAQ
What operators does this Boolean algebra calculator support?
It supports AND (written as ·, *, ., &, or the word AND), OR (+, |, or OR), NOT (!, ~, ¬, a trailing apostrophe, or the word NOT), and XOR (^, ⊕, or XOR), along with parentheses for grouping and the constants 0 and 1. Variables are single letters A through F. You can type operators as words or symbols, and the on-screen buttons insert the correct symbol for you.
How is "AB" different from "A+B"?
Writing two variables next to each other with no operator between them, like AB, is standard Boolean algebra shorthand for A AND B — this is called implicit multiplication, the same convention used in algebra textbooks. A+B means A OR B instead. The calculator recognizes both the explicit AND symbol and this implicit juxtaposition automatically, so A·B, A*B, and AB all evaluate identically.
What does the apostrophe (') or exclamation mark (!) mean?
Both represent logical NOT, also called complement or inversion. An apostrophe is written after a variable, like A', meaning "not A." An exclamation mark or tilde is written before a term, like !A or ~A, with the same meaning. NOT has the highest precedence of any operator, so it always applies to the smallest possible unit directly next to it unless parentheses say otherwise.
What operator precedence does the calculator use?
From highest to lowest precedence: NOT, then AND, then XOR, then OR. This mirrors the convention used in most programming languages and digital logic textbooks. So A + B·C is read as A + (B·C), not (A+B)·C. When an expression could be read more than one way, it's always safest to add your own parentheses rather than rely on precedence rules.
How does the calculator simplify an expression?
It builds the full truth table for your expression, extracts the rows where the output is true (the minterms), and runs the Quine–McCluskey method: it repeatedly merges minterms that differ in exactly one variable to find every prime implicant, identifies which prime implicants are essential because they're the only one covering a particular true row, and then covers any remaining true rows with the fewest additional terms. The result is a minimized sum-of-products (SOP) expression with as few terms and literals as the method can find.
Is the simplified form guaranteed to be the absolute smallest possible expression?
It's a minimal or near-minimal sum-of-products form found through essential prime implicant selection followed by a best-fit covering step, which is how most textbook Quine–McCluskey exercises are solved. For the vast majority of expressions with a handful of variables, this produces the true minimum; for some boundary cases, an alternative minimal cover of equal size may also exist. Treat the result as a correct and properly minimized expression rather than the one and only possible answer.
What is a Karnaugh map and when does the tool show one?
A Karnaugh map (K-map) arranges every row of a truth table into a grid ordered so that any two adjacent cells differ by exactly one variable, which makes visual grouping of true values a faster alternative to algebraic simplification by hand. This calculator generates one automatically for any expression using 2 to 4 variables, since that's the range where a K-map stays easy to read on a screen; for 5 or 6 variables, the truth table and minimized expression are shown instead.
What's the difference between the SOP and POS forms shown in the results?
Sum-of-products (SOP), also called the canonical disjunctive normal form, lists every input combination that makes the expression true, ANDed together as a single term and OR'd across all such rows — this is the unsimplified, exact logical equivalent of your expression. Product-of-sums (POS), or conjunctive normal form, does the reverse: it lists every combination that makes the expression false. Both are mathematically exact; the minimized expression above them is what you'd actually use in a real circuit or simplified condition.