Free interactive digital logic tool

Logic Gate Simulator

Explore how digital logic gates process binary inputs. Toggle switches, test AND, OR, NOT, NAND, NOR, XOR and XNOR gates, connect gates into simple combinational circuits, and generate a truth table for your circuit.

1. Try a logic gate

Change the inputs and watch the output update immediately.

Binary input switches

A binary input can be either 0 (LOW) or 1 (HIGH).

Input A 0
Input B 0
AND OR NOT NAND NOR XOR XNOR

AND returns 1 only when both inputs are 1.

Live gate output

The output is recalculated when a switch or gate changes.

Output Y
0
Y = A AND B

Both inputs are LOW, so the output is 0.

ABY

The highlighted row matches your current input switches.

2. Build a logic circuit

Add gates and connect each input to A, B, a constant, or an earlier gate output.

Add a gate or select an example circuit to begin.
Selected output
Y = A
Output bit
0

3. Circuit truth table

Every possible A/B combination is evaluated through your circuit.

This builder uses two external inputs, A and B.

What are logic gates?

Logic gates are the basic building blocks of digital electronics. They take one or more binary inputs and produce a binary output according to a Boolean rule. Digital circuits combine gates to perform operations used in processors, memory systems, control circuits and arithmetic units.

This logic gate simulator is useful for learning digital logic, checking truth tables, testing Boolean operations and exploring how a small combinational circuit behaves. It evaluates the logical behavior of a circuit; it does not model transistor-level electrical characteristics, propagation delays or voltage levels.

Logic gate reference and truth tables

The following definitions describe the seven gate types available in this simulator. For two-input gates, A and B can each be 0 or 1.

AND gate

Y = A AND B

Output is 1 only when both inputs are 1.

ABY
000
010
100
111

OR gate

Y = A OR B

Output is 1 when at least one input is 1.

ABY
000
011
101
111

NOT gate

Y = NOT A

Output is the inverse of the single input.

AY
01
10

NAND gate

Y = NOT (A AND B)

Output is 0 only when both inputs are 1.

ABY
001
011
101
110

NOR gate

Y = NOT (A OR B)

Output is 1 only when both inputs are 0.

ABY
001
010
100
110

XOR gate

Y = A XOR B

Output is 1 when the two inputs differ.

ABY
000
011
101
110

XNOR gate

Y = NOT (A XOR B)

Output is 1 when both inputs are equal.

ABY
001
010
100
111

Example circuits to try

Use the examples in the builder to explore common circuit patterns. The output and truth table update whenever you change a connection.

How to use the logic gate simulator

  1. Toggle A and B to set the binary input values.
  2. Select a gate to see its current output and truth table.
  3. In the circuit builder, add one or more gates.
  4. Choose input sources for each gate. A gate can use A, B, a constant 0 or 1, or the output of an earlier gate.
  5. Select the final output to display the circuit's truth table.
  6. Download or copy the truth table as CSV for your notes or spreadsheet.

The builder is intentionally limited to combinational circuits with two external inputs. It evaluates gates in dependency order and prevents a gate from connecting to its own output or a later gate, avoiding feedback loops that would require sequential simulation.

Frequently asked questions

What is a logic gate?

A logic gate is a digital circuit that applies a Boolean operation to binary inputs and produces a binary output. Gates are combined to build more complex digital systems.

What is the difference between AND and OR?

AND outputs 1 only if all inputs are 1. OR outputs 1 if at least one input is 1. For two inputs, both gates output 0 for A = 0 and B = 0.

What is the difference between XOR and XNOR?

XOR outputs 1 when the inputs differ; XNOR outputs 1 when they match. XOR is commonly used for binary addition and parity logic, while XNOR is useful for equality comparisons.

Why are NAND and NOR called universal gates?

Any Boolean logic function can be constructed using only NAND gates or only NOR gates. This makes them universal building blocks for digital logic.

Can I use this tool to create a flip-flop or counter?

This version is for combinational logic. Flip-flops, latches and counters depend on stored state, feedback or clock behavior, which this simulator does not model.

Can I save the truth table?

Yes. Use the download button to save a CSV file, or copy the CSV text and paste it into a spreadsheet or text editor.

Related binary and logic tools

Continue exploring binary arithmetic, Boolean logic and digital systems: