Logic Gate Simulator
Flip the inputs, switch between gates, and watch the output respond instantly. This is the same 0-and-1 logic behind the physical binary counter challenge, just built from gates instead of cups.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
The logic behind it
Every decision a computer makes, no matter how complicated, eventually comes down to combinations of gates just like these — each one is just a fixed rule for turning one or two 0s and 1s into a single 0 or 1.
The four rules:
- AND — output is 1 only when both inputs are 1.
- OR — output is 1 when at least one input is 1.
- XOR — output is 1 only when the inputs are different from each other.
- NOT — flips its single input: 1 becomes 0, 0 becomes 1.
The physical binary counter challenge has you count from 0000 to 1111 by hand, flipping cups. Every one of those flips is really the output of a small chain of gates like these deciding whether a bit should carry over to the next position — the counter is what you get when you wire enough of these together.
Real logic gates are built out of transistors — tiny electronic switches, not the shapes drawn here. This simulator shows the logic each gate performs, not the physical electronics that actually implement it, which is its own deep topic in computer engineering.
More on algorithms as a concept →