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 Evaluation

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 on its own is enough to build all of them, a property called functional completeness, and it is why a chip designer can lay out an entire processor from one cell type. (NAND flash is named for something else, incidentally: its memory cells are wired in series in a way that resembles the transistor arrangement of a NAND gate. The naming is about topology, not about logic.)

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, it is what lets a designer build any circuit out of nothing but NAND gates, or nothing but NOR gates. The Apollo Guidance Computer took the second route: roughly 2,800 integrated circuits, every one of them a dual three-input NOR gate, and no other logic part in the machine.

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, because addition does not distribute over multiplication in real numbers: 2 + (3 × 4) is 14, while (2 + 3) × (2 + 4) is 30. 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). XOR is its own inverse: apply the same key twice and you are back where you started, since (A ⊕ K) ⊕ K = A. That single property is the whole reason it works for stream ciphers.

What the calculator shows

Enter A, B and C and you get every two-input gate output, one expression of your choosing evaluated across all eight rows of the truth table, and six algebraic laws worked through with your values substituted in.

Those six laws are identities, which means they hold for every possible input. The point of showing them is not to test whether they are true, it is to watch the substitution happen: seeing (1 · 0)′ = 0′ = 1 land on the same answer as 1′ + 0′ = 0 + 1 = 1 is how De Morgan stops being a rule to memorise. Change your inputs and both sides move together, every time.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.