Boolean Algebra Calculator
Evaluate Boolean expressions with AND, OR, NOT, NAND, NOR, XOR for three variables.
Verify De Morgan, absorption, distribution, and identity laws.
Boolean algebra is the math behind every digital circuit, every conditional in code, every database WHERE clause. Two values (0 = false, 1 = true) and three primitive operations:
AND (·, &, ∧): true only when both inputs are true. OR (+, |, ∨): true when at least one input is true. NOT (’, ¬, !): flip the value.
Every other gate (NAND, NOR, XOR, XNOR, implication) can be built from those three. NAND alone is enough to build everything, which is why NAND flash got its name; the entire memory cell is a single gate type.
The laws that actually get used:
De Morgan’s Laws are the most-used identity in real circuit design and refactoring. They let you swap a NOT-of-AND for an OR-of-NOTs and vice versa:
- (A · B)’ = A’ + B'
- (A + B)’ = A’ · B'
In code, this is what lets you replace !(x > 0 && y > 0) with x <= 0 || y <= 0 — same logic, different shape. In hardware, this is what lets a designer build any circuit out of just NAND gates (or just NOR gates — the Apollo Guidance Computer used only NOR).
Absorption: A + (A · B) = A, and A · (A + B) = A. Whatever B is, the result reduces to A. This is the one that simplifies bloated expressions in practice. Beginners write x || (x && y) thinking they need both clauses; it’s just x.
Distribution mirrors regular algebra, but it works both ways in Boolean:
- A · (B + C) = (A · B) + (A · C)
- A + (B · C) = (A + B) · (A + C)
The second form has no arithmetic analogue — addition doesn’t distribute over multiplication in real numbers. Boolean algebra is symmetric in a way regular algebra is not.
Identity and complement: A + 0 = A, A · 1 = A, A + A’ = 1, A · A’ = 0. These are how you collapse most simplifications down to nothing. If your expression reduces to A · A’, it’s identically false; if it reduces to A + A’, it’s identically true (a tautology).
XOR is not primitive. It’s defined as A ⊕ B = A · B’ + A’ · B (true when exactly one input is true). It shows up everywhere in encryption (one-time pads, AES round keys), parity checking, and graphics blending (XOR cursor draw was how every text editor undrew its cursor before alpha compositing). Pick any value for A; XOR with that value twice gets you back the original. That’s the whole reason it works for stream ciphers.
This calculator takes A, B, C as three Boolean inputs and shows the full set of gate outputs plus side-by-side verification of the four major laws on your particular input values.