How to type your expression
Variables are single letters (A, B, C… or p, q, r). The generator accepts the most common notations from digital electronics, logic and programming:
| Operation | You can type | Example |
|---|---|---|
| NOT | A' !A ~A ¬A | (A+B)' |
| AND | A·B A*B A&B A∧B AB | AB'C |
| OR | A+B A|B A∨B | A + BC |
| XOR | A^B A⊕B | A ⊕ B ⊕ C |
| Implication | A->B A=>B A→B | p → q |
| Equivalence (XNOR) | A<->B A↔B A≡B | p ↔ q |
Operator precedence, from highest to lowest: NOT, AND, XOR, OR, implication and equivalence. Writing two variables side by side means AND (AB = A·B). When in doubt, use parentheses.
How a truth table is built
With n variables there are 2n possible combinations. They are listed in binary order (000, 001, 010…) and the expression is evaluated for each row. Intermediate columns make it harder to slip up: negations first, then products, then sums.
Example · F = A·B + C'
With 3 variables there are 8 rows. A·B is 1 only in rows 6 and 7 (A = B = 1) and C' is 1 when C = 0, that is, in rows 0, 2, 4 and 6. Adding them: F = Σm(0, 2, 4, 6, 7) and therefore F = ΠM(1, 3, 5).
Minterms, maxterms and canonical forms
A minterm is a product containing every variable (complemented or not) that is 1 in exactly one row. Adding the minterms of the rows where the function is 1 gives the canonical sum of products (SOP). A maxterm is the sum that is 0 in exactly one row; multiplying the maxterms of the rows where the output is 0 gives the canonical product of sums (POS). Both describe the same function, but they are rarely the shortest: to simplify them use the Karnaugh map solver.
Watch the convention: in a minterm a variable appears uncomplemented if it is 1 in that row; in a maxterm it is the other way round, complemented if it is 1.
Frequently asked questions
How do I check whether two expressions are equivalent?
Type (expression 1) ↔ (expression 2). If every row is 1 (a tautology), they are equivalent. Try the De Morgan example.
What are a tautology and a contradiction?
A tautology is 1 for every input combination; a contradiction is always 0. If it is neither, the expression is called contingent.
Why is A → B true when A is 0?
An implication is only false when the premise is true and the conclusion is false. If the premise is false the implication is not broken, so it counts as true. It is equivalent to A' + B.
How many variables can I use?
Up to 10, which gives 1,024 rows. For 2 to 4 variables you can jump straight to the Karnaugh map to get the minimal expression.
More computer science tools
Two's Complement Calculator
Signed integers in two's complement, one's complement and sign-magnitude, plus overflow.
OpenIEEE 754 Floating-Point Converter
32 and 64-bit floating point with biased exponent and rounding error.
OpenKarnaugh Map Solver
Minimal SOP and POS expressions with the groups highlighted on the map.
OpenIPv4 Subnet Calculator
Network, broadcast, hosts, wildcard and VLSM planning with the binary AND.
OpenNumber Base Converter
Binary, octal, decimal, hex and bases 2–36 with repeated division.
OpenSorting Algorithm Visualizer
Animated sorting with comparison and write counters.
Open