Boolean Operators Explained: AND, OR, NOT, XOR with Examples

Master all Boolean operators with clear examples. Learn AND, OR, NOT, XOR, NAND, NOR operations with truth tables and practical applications in programming and circuits.

The 7 Essential Boolean Operators

Boolean operators are the building blocks of digital logic. Master these operators and you'll understand how every computer works.

AND Operator (·)

Returns TRUE only when ALL inputs are TRUE.

ABA·B
000
010
100
111

Symbols: · ∧ × (or just write AB)

Real-world example: A security gate that only opens when BOTH a valid ID card AND correct PIN are provided.

OR Operator (+)

Returns TRUE when ANY input is TRUE.

ABA+B
000
011
101
111

Symbols: + ∨

Real-world example: An alarm that triggers if the door OR window sensor is activated.

NOT Operator (')

Inverts the input value.

AA'
01
10

Symbols: ' ¬ ~ (or overline Ā)

XOR Operator (⊕)

Returns TRUE when inputs are DIFFERENT.

ABA⊕B
000
011
101
110

Real-world example: A light controlled by two switches - toggle either switch to change the light state.

NAND Operator

NOT AND - inverted AND output. A NAND B = (A·B)'

NAND is a universal gate - any Boolean function can be built using only NAND gates.

NOR Operator

NOT OR - inverted OR output. A NOR B = (A+B)'

NOR is also a universal gate.

XNOR Operator

NOT XOR - true when inputs are the SAME. A XNOR B = (A⊕B)'

Operator Precedence

  1. NOT (highest priority) - evaluated first
  2. AND - evaluated second
  3. OR (lowest priority) - evaluated last

Example: A + B·C' is evaluated as A + (B · (C'))

Practice with Tools

Frequently Asked Questions

What is the difference between AND and OR?
AND requires ALL inputs to be true for a true output (1·1=1, anything else = 0). OR requires at least ONE input to be true (0+0=0, anything else = 1).
What does XOR mean?
XOR means exclusive OR - it returns true when the inputs are DIFFERENT. A XOR B is true when A=1,B=0 or A=0,B=1, but false when both are the same.
What is operator precedence in Boolean algebra?
The precedence order is: NOT (highest), then AND, then OR (lowest). So A+B·C is evaluated as A+(B·C), not (A+B)·C.
What are universal gates?
NAND and NOR are called universal gates because any Boolean function can be implemented using only NAND gates or only NOR gates.