Logic Gates Simulator — AND, OR, XOR, NAND, NOR, NOT & Truth Tables

Interactive logic gate simulator — choose AND, OR, XOR, NAND, NOR or NOT, flip the input switches, follow the signal to the output lamp, and compare against the full four-row truth table.

← Computer Science Labs
About this tool — how it works & FAQOpen ▾Close ▴

About the Logic Gates Simulator

This simulator is a digital trainer for the six basic gates. You set the inputs, pick the gate and watch the signal travel through a gate symbol to an output lamp, then compare the result with the complete truth table, either by hand or by letting the lab cycle through the rows.

What the simulator shows

• A 3D trainer with input switches, the selected gate symbol, digital signal paths, an output indicator and a truth-table display. • A Gate selector (AND, OR, XOR, NAND, NOR, NOT), manual inputs A and B, and an Automatically cycle truth-table rows checkbox. • Readouts for active A, active B, gate output, the active truth-table row and how many of the four rows give a high output. • Restart demonstration and Advance event buttons, plus experiments for XOR with equal inputs and for NOT ignoring B.

The Boolean definitions

AND is high only when both inputs are high; OR is high when either is; XOR is high only when the inputs differ. NAND is the inversion of AND, NOR the inversion of OR, and NOT simply inverts A. Comparing the counts of high outputs across the four rows makes the pairs obvious: AND has one, OR three, XOR two, NAND three and NOR one. NOT is deliberately shown as a one-input gate, so input B has no effect on it — the output is one whenever A is zero.

What the model is and is not

These are ideal combinational gates in Boolean logic. Real devices also have voltage thresholds, propagation delays, fan-out limits and hazards, all outside this model. Each event lasts 0.8 animation seconds, and the signal markers are explanatory rather than measured hardware timing.

Frequently asked questions

Which gate is high only when the inputs are unequal?

XOR. OR is also high for inputs of 1 and 1, which is the difference the XOR experiment highlights: with equal inputs, XOR outputs zero.

How many inputs does NOT use in this lab?

One. Input B is deliberately ignored, so the output is the inverse of A regardless of B.

What is the relationship between AND and NAND?

NAND is the complement of AND: it outputs zero only when both inputs are one. Likewise NOR is the complement of OR.

What does the truth-table cycling option do?

It steps through the four A and B combinations automatically so you can see the output for each row without changing the switches yourself, and the active-row readout tells you which row is shown.

Related tools & guides