Logic Gate Simulator
Add switches, add gates, wire the pins, and the stage prints what every gate is reading the moment anything changes. Three things here work differently from the usual applet. A pin with nothing wired into it reads as unknown, drawn as a question mark, instead of being counted as a silent zero that quietly changes every value downstream; a 0 into an AND or a 1 into an OR still settles the answer, because those gates need no second value to decide. A wire that loops back into an earlier gate is refused and the gates in the loop are named, because feedback requires state and timing behavior that this combinational simulator does not model. And the circuit is plain text on the stage and plain JSON behind the Copy button, so what the tool computed is something you can read, check and keep. Up to 32 gates and 8 switches, every control reachable from the keyboard, all of it in your browser with no account and nothing uploaded.
A = 1 B = 0 G1 AND A, B = 0 G2 OR A, B = 1 G3 XOR G1, G2 = 1 output OUT = 1 (G3)
- Gates
- 3
- Inputs
- 2
- Output
- 1 (G3)
- Cycles
- None
3 gates, 2 switches. G3 reads 1, recomputed on every flip.
Switches
Flip a switch and every gate that depends on it is worked out again. A pin left open reads as unknown, drawn as a question mark on the stage.
Gates and wires
Each row is one gate: its kind, what is wired into each pin, and whether it is the output the stage reads. Wire a pin to a gate that already depends on it and the circuit is refused, with the loop named.
- G1
- G2
- G3
AND 1 only when both inputs are 1OR 1 when either input is 1NOT flips its single inputXOR 1 when the inputs differNAND AND with the output flippedNOR OR with the output flipped
Try these
Truth tables
Every row below is computed by the same function the stage uses, so the table and the canvas cannot disagree. NOT has one input: NOT 0 is 1, NOT 1 is 0.
| A | B | AND | OR | XOR | NAND | NOR |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 |
Common questions
- How do I build a circuit?
- Add the switches you need, then add gates with the buttons under the canvas: AND, OR, NOT, XOR, NAND and NOR. Each gate gets a row with its kind and one drop-down per pin, and a pin can be wired to any switch or any other gate. Choose which gate the stage reads as the output with the radio on its row. Flipping a switch re-evaluates everything that depends on it straight away, so the values on the stage are always the values of the circuit in front of you.
- Why does a gate show a question mark instead of 0 or 1?
- Because one of its pins has nothing wired into it, and an open pin has no value. Treating it as 0 would be a guess, and the guess would travel through every gate downstream, so this page marks the pin as open and the gate as unknown. Unknown spreads only where the answer really depends on it: a 0 into an AND is still 0 and a 1 into an OR is still 1 whatever the other pin turns out to be, while XOR needs both pins every time. The line under the canvas names the first open pin so you know exactly which drop-down to fill.
- Why will it not let me wire a gate's output back to its own input?
- It lets you wire it, and then it refuses to pretend it knows the answer. A wire that runs back into a gate the signal already passed through is feedback, which is what latches and flip-flops are made of, and its behavior depends on stored state and timing rather than one combinational pass. Latches need not have a clock; this page models neither stored state nor clocked behavior. So the stage names the gates in the loop, says to unwire one of those inputs, and shows no value for any gate while the loop is there. That refusal is the honest answer, and it is worth more than a number picked from whichever pass happened to run first.
- What is a NAND gate, and why is NAND(1,1) equal to 0?
- NAND is an AND gate with its output flipped, so it gives 0 only when both inputs are 1, and 1 in every other case. NOR is an OR gate flipped the same way: 1 only when both inputs are 0. They matter because either one on its own can build every other gate, which is why real chips are full of them. The truth tables printed under the tool are computed by the same function the canvas uses, so the table and your circuit can never disagree.
- Can I build a flip-flop, a latch or a counter?
- No, and the page says so rather than producing something that looks like an answer. Those are sequential circuits: their output depends on stored state. Flip-flops and synchronous counters use a clock; asynchronous latches need not. This simulator is combinational only, so it evaluates each gate once, in an order that follows the wires, and refuses any circuit with a loop in it. Half adders, full adders, multiplexers, parity checkers and anything else built from gates alone all work.
- How many gates and switches can I use?
- Up to 32 gates and 8 switches, named A to H. Those are limits on the drawing rather than on the arithmetic: the stage prints one line per gate, and a longer circuit would be a scroll bar rather than a diagram. Nothing is silently dropped to fit, either: at the limit the Add button stops and the page says the canvas is full, and a circuit read back from a saved or copied file that is over the limit is refused whole, with a message naming the limit and the size of the file, rather than trimmed.
- Can I save or export what I built?
- Copy JSON hands you the whole circuit as readable JSON: the switches and their positions, every gate with its type and its wires, and which node is the output. If the browser will not give the page the clipboard, the page says so and that same JSON opens in a box under the readout, ready to select and copy by hand. The same JSON is what this browser keeps for you, so the canvas comes back as you left it the next time you open the page, and Blank canvas below the stage empties the circuit and remembers the blank canvas. Nothing is uploaded and no account is involved: the evaluation, the drawing and the export all happen in your browser.
- Is it accurate?
- The Boolean part is exact under the stated three-value model: each gate applies its truth-table rule to known input bits and preserves an unknown value when an open pin can affect the answer. The displayed elementary gate tables use those same rules. The page has no clock, propagation delay, glitch or race behaviour, or sequential elements, so it does not model how a physical circuit settles over time.
- Can I use the truth tables to learn how a circuit works?
- The tables show the input combinations for each elementary gate. Add switches and gates, choose sources in the pin drop-downs, select the output radio and flip a switch to inspect your own combinational circuit. Its current node values update on the stage. The page does not generate an exhaustive truth table for every input combination of a custom circuit.
- Can I use this logic gate software on Android, Mac, Windows or Linux?
- Use the simulator in a current browser on your phone or computer. The same switch, gate and pin-source controls build a combinational circuit, show its current values and copy the circuit as JSON. The controls also work from the keyboard. This is browser software; it does not provide a native app, APK, installer or a version 1.4 package.
Exact Boolean evaluation of the circuit you draw, recomputed the moment a switch moves. It handles combinational circuits only: a loop back into an earlier gate is refused and named rather than simulated, because it requires state and timing behavior this page does not model.