1001Ferramentas
🔣 Dev

Truth Table

Generate truth tables for Boolean logic expressions. Supports AND, OR, NOT, XOR, NAND and NOR. Auto-detects variables and shows all possible combinations. Processed in the browser.

Operadores: AND && OR || NOT ! XOR NAND NOR — variáveis: letras maiúsculas (A, B, C…)

Operadores suportados

OperadorSintaxeDescrição
ANDA AND B, A && BVerdadeiro se ambos forem V
ORA OR B, A || BVerdadeiro se ao menos um for V
NOTNOT A, !ANegação
XORA XOR BVerdadeiro se exatamente um for V
NANDA NAND BNOT (A AND B)
NORA NOR BNOT (A OR B)

Check your logic against every case

A three-clause if statement, a logic exercise, a digital circuit you need to double-check: the question is always the same, does the expression do what you expect in every combination? Type it using AND, OR, NOT, XOR, NAND and NOR (or &&, || and !) and the truth table renders instantly, one row per combination of values, with the result column highlighted in green and red. There is no button to press: the table rebuilds on every keystroke.

Precedence matters here: NOT is evaluated first, then AND and NAND, and finally OR, XOR and NOR, which share the lowest level and associate left to right. So A AND B XOR C is read as (A AND B) XOR C, and A XOR B OR C becomes (A XOR B) OR C, which may not be what you meant. Variable names can be whole words (SENSOR, VALVE), upper and lower case count as the same variable, and the limit is 8 variables, which means 256 rows.

When in doubt about precedence, add parentheses and move on. One genuinely useful trick: test equivalences such as De Morgan's laws by generating the table for NOT (A AND B), then for NOT A OR NOT B, and comparing the result columns. The tool only enumerates cases, it does not simplify the expression (that is Karnaugh map territory). Everything is computed in JavaScript in your browser; nothing leaves the page.

Frequently asked questions

What is the operator precedence?
NOT first, then AND and NAND, then OR, XOR and NOR, all left-associative. If an expression looks ambiguous to you, use parentheses: they always win.
How many variables can I use?
Up to 8, which produces 256 rows. Beyond that the tool shows an error instead of freezing your browser.
Can variable names be longer than one letter?
Yes. Any word that is not an operator becomes a variable (SENSOR, DOOR). Case is ignored, so a and A are the same variable.

Related Tools