A and not B
You enter
- Expression
- A & !B
You get
- Rows
- A B | Result; 0 0 | 0; 0 1 | 0; 1 0 | 1; 1 1 | 0
The result is true only when A is true and B is false. That is the single row 1 0, so the Result column has one 1.
Run through the tool’s own code.
Developer tool
Enter a Boolean expression using variables A–Z, parentheses, !, &, |, ^, -> and <->.
Values are processed locally in this browser.
About this tool
The expression is parsed as Boolean logic locally and is never executed as JavaScript. Operator precedence is shown in the help beneath the tool.
Guide
The Logic Truth Table Generator builds a table for a Boolean expression. You type something like A & !B, and it lists every mix of 0 and 1 for the letters and the result for each row. It accepts up to six different variables and the operators not, and, or, xor, implies and if-and-only-if. It reads the text as logic and never runs it as code, and it does not simplify the expression.
The result is true only when A is true and B is false. That is the single row 1 0, so the Result column has one 1.
Run through the tool’s own code.
A -> B is false only when A is true and B is false. If A is false the statement counts as true whatever B is.
Run through the tool’s own code.
The tool groups ^ before |, so this reads (A xor B) or C. In row 1 1 0 the xor is 0 and C is 0, which gives 0. Other tools may group these two differently.
Run through the tool’s own code.
With A = 0, B = 0, C = 0 the inner part B -> C is true, so the whole statement is true. Grouping to the left, (A -> B) -> C, would give 0 in that row, so the grouping matters.
Run through the tool’s own code.
A column of all 1s means the two sides match in every row. This is one of De Morgan's laws, and the table confirms it for all four combinations of A and B.
Run through the tool’s own code.
Common questions
You can use ! (not), & (and), | (or), ^ (xor), -> (implies) and <-> (if and only if). From tightest to loosest the tool applies them in the order !, &, ^, |, ->, <->. Brackets always come first, so use them whenever the order is unclear.
Look at the Result column. If every row shows 1, the expression is true for all combinations, which logicians call a tautology. If every row shows 0 it is a contradiction. A mix of 0 and 1 means the result depends on the inputs.
It means implies, as in if A then B. The statement is false only when A is true and B is false. When A is false it is true no matter what B is. The tool groups a chain like A -> B -> C to the right.
No. The page says the text is parsed locally as Boolean logic and is never executed as code. The tool breaks it into allowed pieces and rejects anything else, which is why unknown symbols return an error instead of doing something.
Between one and six different letters. The columns are sorted alphabetically, and every extra variable doubles the number of rows, so six variables give 64 rows. An expression made only of 0 and 1 has no variable and is refused.
Yes. The tool reads 0 as false and 1 as true, so A & 1 behaves like A. The help line on the page lists only letters and operators, but constants are accepted by the code, as long as at least one letter is present.
Enter a Boolean expression using variables A–Z, parentheses, !, &, |, ^, -> and <->.
No. This tool runs locally in your browser. Your input is not uploaded.