Design digital logic circuits right in your browser. Drag gates, switches, LEDs, a clock and flip-flops onto the board, connect pins with wires and flip the switches to watch signals propagate. The truth table and a simplified Boolean expression update as you build.
Last updated:
Inputs / outputsGatesMemory
Truth table
Advertisement
Advertisement
How to use the Logic Gate Simulator
Drag parts onto the board from the toolbar (or click a part to drop it in a free spot). Start with Switches for inputs and LEDs for outputs.
Wire the circuit: press on an output pin (right side of a part) and drag to an input pin (left side). Drag a wire off an input to move or remove it.
Flip the switches by clicking them; wires and pins turn green when they carry a 1, and LEDs light up.
Read the truth table below the board: it lists every input combination and the simplified Boolean expression for each LED.
For sequential circuits, add a Clock and flip-flops, then press Start clock or Step clock. Download the truth table or save the circuit when you are done.
Logic gates reference
Gate
Output is 1 when…
Expression
A=0,B=0
0,1
1,0
1,1
AND
all inputs are 1
A·B
0
0
0
1
OR
at least one input is 1
A + B
0
1
1
1
XOR
an odd number of inputs are 1
A ⊕ B
0
1
1
0
NAND
not all inputs are 1
(A·B)'
1
1
1
0
NOR
all inputs are 0
(A + B)'
1
0
0
0
XNOR
an even number of inputs are 1
(A ⊕ B)'
1
0
0
1
NOT
the single input is 0
A'
A=0 → 1, A=1 → 0
NAND and NOR are called universal gates: any circuit can be built from either one alone. The XOR from 4 NAND gates example shows how.
Flip-flop characteristic tables
Type
Inputs at the rising clock edge
Next Q
D flip-flop
D = 0 / D = 1
0 / 1 (Q follows D)
T flip-flop
T = 0 / T = 1
Q (hold) / Q' (toggle)
JK flip-flop
J=0,K=0 · J=0,K=1 · J=1,K=0 · J=1,K=1
hold · 0 · 1 · toggle
SR latch (no clock)
S=1,R=0 · S=0,R=1 · S=0,R=0 · S=1,R=1
1 · 0 · hold · invalid (Q = Q̅ = 0)
Classic circuits to try
Half adder: adds two bits. Sum S = A ⊕ B, carry C = A·B. 1 + 1 gives S = 0, C = 1, which is binary 10.
Full adder: adds two bits plus a carry-in, the building block of every binary adder. Chain full adders to add multi-bit numbers, and check the results with the Binary Calculator.
2-to-1 multiplexer: Y = A·S' + B·S, so the select switch S chooses which input reaches the output.
2-bit counter: two T flip-flops on the same clock. Q0 toggles every cycle and Q1 toggles when Q0 is 1, so Q1Q0 counts 00, 01, 10, 11. Watch it with Start clock.
To see how gate operations act on whole binary numbers at once, try the Bitwise Calculator (AND, OR, XOR and NOT on integers).
Frequently asked questions
How do I connect two gates?
Press on the small circle on the right side of a part (its output) and drag to the circle on the left side of another part (an input), then release. The wire snaps to the nearest input within a short distance. An input accepts only one wire; connecting a new one replaces the old one. To remove a wire, click it and press Delete, or drag it off the input pin and release on empty board.
What do the colors mean?
A green wire, pin or gate fill carries a logic 1 (high); grey means 0 (low). Switches show 1 or 0, and an LED glows when its input is 1. Unconnected inputs are treated as 0.
How is the truth table made?
The simulator sets the switches to every combination from all 0s to all 1s (2^n rows for n switches), lets the circuit settle, and records each LED. Columns follow the parts' positions on the board from top to bottom, so place switch A above switch B to get the usual order. The row matching the current switch positions is highlighted.
How is the Boolean expression simplified?
Each output's minterms (the rows where it is 1) are reduced with the Quine–McCluskey method, which merges terms that differ in one variable, and then a set of prime implicants covering every minterm is chosen. The result is a correct sum of products that is minimal or close to minimal; A' means NOT A, a dot means AND and + means OR.
How do the flip-flops behave?
The D, JK and T flip-flops are positive-edge triggered: they change only when their CLK input goes from 0 to 1. D copies its input; JK sets with J, resets with K and toggles when both are 1; T toggles when T is 1. The SR latch is level-sensitive: S=1 sets Q, R=1 resets it, and S=R=1 is the invalid state where both outputs are 0.
Why does it say the circuit oscillates?
A feedback loop with an odd number of inverters, such as a NOT gate whose output feeds its own input, never settles to a stable value. The simulator stops after a fixed number of passes and shows a warning. Loops with an even number of inversions, like the cross-coupled NOR latch, are stable and work as memory.
Is my circuit saved?
Yes, the current circuit is stored in this browser's local storage and reopens when you return. Use Download circuit to keep a .json file you can open later or share; nothing is uploaded.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.