Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Logic gate simulator

Build logic from AND, OR, NOT, XOR, NAND, NOR and XNOR gates, flip the inputs to see the output, and get the full truth table at once.

Inputs (tap to switch 0 / 1)

Output: ?

Truth table

How to use

  1. Type an expression using input names (A, B, C, or words like Cin) and gates: AND, OR, NOT, XOR, NAND, NOR, XNOR. Short forms work too: & | ! ^.
  2. Or pick a ready-made gate or circuit, such as a half adder or a 2-to-1 selector.
  3. Tap the input buttons to switch each input between 0 and 1 and watch the output.
  4. The truth table lists every combination; your current one is outlined, and rows where the output is 1 are shaded.

Keyboard and touch

TabMove to the input buttons
Space or EnterSwitch the input under the focus
BracketsUse ( ) to group, for example NOT (A OR B)

Tips

  • NOT is done first, then AND, then XOR, then OR. Add brackets whenever you are unsure.
  • NAND alone can build every other gate. Try A NAND A (it acts like NOT A).
  • The "De Morgan check" preset is always 1: NOT (A AND B) is the same as NOT A OR NOT B.
  • A full adder adds three bits: its sum and carry outputs make a 2-bit answer.

About this tool

Gate rules: AND is 1 only when both inputs are 1; OR when at least one is 1; NOT flips its input; XOR when exactly one is 1; NAND, NOR and XNOR are the opposites of AND, OR and XOR. The truth table tries every one of the 2n input combinations (up to 8 inputs, 256 rows). The "output is 1 for" line lists those rows as a sum of products, where A' means NOT A. Nothing is saved or sent.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product