Logic Gates Simulator

Flip the switches and watch current flow through AND, OR, NOT, NAND, NOR, XOR and XNOR gates. Then wire your own circuit and get its Boolean expression and complete truth table automatically.

Class 11–12 · CBSE 7 gates Live truth tables Boolean algebra & laws

An AND gate gives 1 only when both inputs are 1; an OR gate gives 1 when at least one input is 1; NOT reverses its input. NAND and NOR are the exact opposites of AND and OR, and XOR gives 1 only when the two inputs differ. De Morgan's laws: (A·B)′ = A′ + B′ and (A + B)′ = A′·B′.

Pick a gate

Tap a gate, then tap the switches on the diagram.

AND gate

Truth table

The highlighted row is the one your switches are showing now.

How it works

From one gate to a whole adder

Every digital device — calculator, phone, computer — is built from these seven gates. Each one takes 0s and 1s in and gives a single 0 or 1 out.

Try one gate

Choose a gate and click its switches. The wire turns red when it carries a 1.

Read the truth table

The row that matches your switches is highlighted, so the table stops being abstract.

Wire a circuit

Drop gates on the board and join pins. The Boolean expression and full truth table appear by themselves.

Check your algebra

Type an expression, get the table, and verify any Boolean law with a side-by-side proof.

The seven gates at a glance

GateExpression00011011
ANDA·B0001
ORA+B0111
NAND(A·B)′1110
NOR(A+B)′1000
XORA⊕B0110
XNOR(A⊕B)′1001
NOTA′A=0 → 1A=1 → 0

Writing Boolean algebra

AND is written like multiplication (A·B or AB), OR like addition (A+B), NOT with a bar or a prime (A′). Order of working: NOT first, then AND, then OR — brackets override it.

Remember the two rules that look odd next to ordinary algebra: A + A = A and A + 1 = 1.

De Morgan's theorems

(A + B)′ = A′ · B′

(A · B)′ = A′ + B′

In words: break the bar and change the operator. This is how a circuit made of AND, OR and NOT gates is rebuilt using NAND gates only — cheaper to manufacture, because one NAND chip can do everything.

Universal gates

NAND and NOR are called universal gates because every other gate can be built from copies of just one of them. A NAND with both inputs joined is a NOT; two NANDs make an AND; three make an OR.

That is why real chips are packed with NAND gates — and why the challenges here ask you to rebuild AND, OR and NOT from NAND alone.

Exam tip: in CBSE Class 11 and 12 Computer Science, Boolean algebra questions usually ask for a truth table, a simplification using the laws, or a circuit drawn from an expression. Use the builder to draw the circuit, then the Boolean tools to prove your simplified answer matches — the comparison checks every row for you.
Questions & answers

Logic Gates Simulator — your questions

What is the truth table of an AND gate?

An AND gate has output 1 only when every input is 1. For two inputs A and B: 0,0 gives 0; 0,1 gives 0; 1,0 gives 0; and 1,1 gives 1. It is written A·B or simply AB, because AND behaves like multiplication — the answer is 1 only if nothing in the product is 0.

What is the difference between OR and XOR?

An OR gate gives 1 when at least one input is 1, so 1,1 also gives 1. An XOR (exclusive OR) gate gives 1 only when the two inputs are different, so 0,1 and 1,0 give 1 but 1,1 gives 0. XOR is written A⊕B and is the gate used to add two bits in a half adder.

What are De Morgan's theorems?

(A + B)′ = A′·B′ and (A·B)′ = A′ + B′. In words: break the bar and change the operator — the complement of a sum is the product of the complements, and the complement of a product is the sum of the complements. They are how a circuit of AND, OR and NOT gates is rebuilt using NAND gates alone.

Why are NAND and NOR called universal gates?

Because every other gate can be built from copies of just one of them. A NAND with both inputs joined together acts as a NOT; two NANDs make an AND; three make an OR. The same is true of NOR. Real chips are packed with NAND gates because one repeated design is cheaper to manufacture.

How many rows does a truth table have?

Two to the power of the number of inputs. Two inputs give 2² = 4 rows, three inputs give 2³ = 8 rows and four inputs give 16 rows. Write the input columns as counting in binary — 00, 01, 10, 11 — so no combination is missed and the rows always come out in the same order.

In what order are Boolean operations worked out?

NOT first, then AND, then OR, with brackets overriding everything — the same idea as BODMAS. So A + B·C means A + (B·C), not (A + B)·C. Two rules that look odd beside ordinary algebra are worth remembering: A + A = A and A + 1 = 1.

How do I prove two Boolean expressions are the same?

Build the truth table for both and compare them row by row; if every row matches for every combination of inputs, the expressions are equal. The Boolean tools tab here does exactly that — type your original expression and your simplified one, press Compare, and it checks every row for you.