Digital logic simulator
Build digital circuits by dragging gates, switches, clocks, LEDs and 7-segment displays, watch the signals light up, and go further with flip-flops, counters, adders, an ALU, RAM and ROM, your own sub-circuits, truth tables with minimised expressions, expression-to-circuit, a timing diagram with real gate delays, and a tiny CPU that runs a program.
Added · updated 28 October 2026
Works with
- HDL trainer: learn Verilog by doing FPGA and HDLturns the circuit saved here into structural Verilog
- Logic analyser IoT and embeddedOpen in logic analyser sends the timing diagram’s signals there, buses split into bits
- Boolean logic Mathematicsopens a circuit’s sum of products as a Karnaugh map
How to use it
A breadboard for digital logic that runs in your browser. Every wire shows its value as you play: bright for 1, dim for 0, red for X (unknown, or two outputs fighting) and blue for Z (nothing driving it); buses are drawn thick with their value written on them.
How to use it
-
Add parts by tapping them in the palette (on a phone it scrolls sideways above the drawing). They appear in the middle of the view; drag them into place. Everything snaps to the grid.
-
Wire by dragging from one pin to another — or, on a touch screen, tap a pin and then the other pin. An output can feed many inputs. Joining two ordinary outputs is refused (it would be a short circuit); use tri-state buffers to share a wire. Widths must match: a 4-bit bus joins only 4-bit pins, so use a splitter or joiner to get at single bits.
-
Play: tap a switch to flip it, hold a push button, tap a Number in to count it up. Run starts the clocks; Step goes to the next clock edge, Cycle runs one whole clock period, and Reset is a power-on reset that clears every flip-flop and memory. Speed is in simulation ticks per second; a clock with a half period of 10 ticks runs at 1 Hz at 20 ticks/s.
-
Select a part or a wire by tapping it. The inspector lets you rename it, change its number of inputs, bus width, delay, clock rate, LED colour, ROM contents and so on, and shows the value on every pin. A selected wire can be added to the timing diagram with Watch. Delete or Backspace removes the selection; ⌘Z / Ctrl+Z undoes, ⌘D duplicates, 0 fits the circuit in view; drag empty space to pan, pinch or scroll to zoom.
-
Full screen (the ⛶ button or the F key; Esc to leave) gives the drawing the whole screen; the ◧ and ◨ buttons (or [ and ]) hide the palette and inspector so it can go edge to edge.
The parts
-
Inputs: switch, push button, clock, constant, and Number in (a bank of DIP switches as one bus).
-
Outputs: LED, probe (binary and decimal), hex display, 7-segment display (segments a–g and the decimal point, lit on 1).
-
Gates: AND, OR, NAND, NOR, XOR, XNOR with 2–8 inputs, NOT, buffer and tri-state buffer. Gates can be up to 16 bits wide (bitwise).
-
Memory: SR latch, D latch, D, JK and T flip-flops (rising-edge triggered, with an asynchronous clear), register, counter (any modulus, up or down, loadable, with carry out), RAM (written on the clock edge when WE = 1, read at once) and ROM.
-
Plexers and arithmetic: multiplexer, decoder, half and full adder, n-bit adder, comparator and an ALU (ADD, SUB, AND, OR, XOR, NOT, shift left and right, with zero, carry, negative and overflow flags).
-
Wiring: splitter and joiner (fields listed lowest bits first:
4,4splits a byte into nibbles), text notes.
Signals and timing
Each wire carries one of four values: 0, 1, X (unknown — a floating gate input, a flip-flop that has never been set, or a short between a 0 and a 1) and Z (high impedance — nothing is driving the wire, as when every tri-state buffer on a bus is off). Gates follow the usual rules for X: AND with any 0 input is 0 whatever the others are, OR with any 1 is 1, otherwise an unknown input gives an unknown output.
The simulator is event-driven, like the ones chip designers use. With Ideal selected every part switches instantly (in zero time, in "delta cycles"), which is easiest to reason about. With Gate delays on, each part’s output changes its delay ticks after its inputs (1 by default, editable per part), so the Glitch (hazard) example shows the brief false 1 that a slow inverter causes, the 4-bit adder shows its carry rippling bit by bit, and the Ring oscillator oscillates with a period of twice the loop delay. Outputs keep every change (transport delay), so even pulses shorter than a gate’s delay are shown.
A loop with no stable state — an inverter wired to itself, or an odd ring of inverters — cannot settle with ideal gates; the status line says so after 2,000 delta cycles. Turn on gate delays to watch it oscillate.
The timing diagram under the drawing shows every clock, input and output (and any wire you watch) against time in ticks: 1-bit signals as high and low lines, buses as values, X and Z as shaded bands. Download VCD saves it as a Value Change Dump (IEEE 1364, one tick = 1 ns) to open in GTKWave or the logic analyzer.
Truth tables, expressions and Karnaugh maps
The Truth table tab lists every combination of the inputs (top to bottom = most significant first, up to 10 bits) and the outputs, simulated from power-on. For each 1-bit output it shows the expression read back through the gates as you built them, and the minimal sum of products and product of sums, found with Quine–McCluskey by the Boolean logic tool; rows that come out X are used as don’t-cares. Karnaugh map in Boolean logic opens that tool on the minimised expression with its K-map drawn and grouped.
The Expression → circuit tab goes the other way: type F = A’B + AB' (one output per line or
separated by ;) and it builds switches, gates and LEDs, laid out in columns by depth with shared
sub-expressions sharing gates. Choose As written, Minimised SOP (via the Boolean logic tool),
or NAND only — every gate turned into NANDs, showing that NAND alone is enough to build any
circuit. Notation: NOT A' !A ~A; AND AB A·B A&B; OR + |; XOR ^ ⊕; also NAND,
NOR, XNOR, → and <→.
Build your own components (sub-circuits)
Put Input pin and Output pin parts on a circuit, label them, and on the Components tab choose Save this circuit as a component. It appears in the palette under "My components" as a box whose pins are the pin labels, top to bottom. Components can contain other components; each circuit carries copies of the definitions it uses, so a shared link or an exported file is complete. Double-click a placed component (or Look inside) to open it, then Save and go back. An input pin can say what the inside sees when nothing is wired to it (If unconnected: 0, 1 or floating). When gate delays are on, a component’s inside runs with its own gates' delays; its pins add none.
Examples
Pick one from Examples… in the toolbar or from the Files & examples tab:
-
Gates tour — two switches feeding all seven basic gates.
-
Half and full adder — S = A ⊕ B, C = A·B, then a full adder as a reusable component.
-
4-bit ripple-carry adder — four full-adder components in a chain, sum in binary and hex.
-
Binary counter — four T flip-flops counting 0 to 15 (each bit toggles when all lower bits are 1: a synchronous counter), with a reset button and a hex display.
-
Traffic light FSM — a finite-state machine in two D flip-flops: green until a car waits, then yellow, red, green. Next-state logic S0⁺ = S1̅·S0̅·C and S1⁺ = S1̅·S0.
-
7-segment decoder — BCD to seven segments from gates, using the textbook equations minimised with don’t-cares for 10–15.
-
Tiny 4-bit CPU — a program counter (a counter with load), a 16-byte ROM holding the program, a 3-to-8 decoder for the opcode, an ALU, an accumulator register A, a carry flag and an output register. Every clock runs one instruction. Select the ROM to edit and assemble the program.
-
SR latch from NOR gates — memory from feedback; it starts unknown until you set or reset it.
-
Glitch (hazard) and Ring oscillator — what gate delays do (gate delays switch on).
The tiny CPU
Each ROM byte is one instruction: the high nibble is the opcode and the low nibble the operand n (0–15). It is a single-cycle machine: on every rising clock edge the instruction at PC executes and PC moves on (or jumps).
| Instruction | Effect |
|---|---|
|
A ← n |
|
A ← A + n (4-bit, wraps); C ← carry out |
|
OUT ← A |
|
PC ← n |
|
if C = 1 then PC ← n |
|
A ← A − n; C ← 1 if there was no borrow (A ≥ n) |
|
nothing |
|
stop: PC stays put |
The demo program is LDI 0, loop: ADD 3, OUT, JMP loop, so OUT shows 3, 6, 9, C, F, 2 …
(4-bit arithmetic wraps). Try LDI 5, l: OUT, SUB 2, JC l, HLT: it counts 5, 3, 1 and halts
when the subtraction borrows. Labels end in a colon and ; starts a comment.
Saving and sharing
The current circuit is kept in this browser automatically. Files & examples saves named copies, exports and imports JSON, and starts a new circuit. Share link (under the title) packs the whole circuit — parts, wires and sub-circuit definitions — into the link, with the gate-delay setting and speed. Your saved circuits and component library are never put in a link.
Limits
-
Edge-triggered parts trigger on a clean 0 → 1 change of their clock; an X clock does nothing. Set-up and hold times are not modelled — with gate delays on a flip-flop simply samples D as it is at the edge.
-
Delays are whole ticks per part (transport delay); there are no rise/fall differences, wire delays, fan-out loading or analogue effects. For voltages and currents use the circuit simulator.
-
Buses are up to 16 bits. On a bus, any unknown bit makes the whole value X. Two non-tri-state outputs cannot be wired together; tri-state outputs that disagree give X (drawn red).
-
Truth tables stop at 10 input bits (1,024 rows). Expression → circuit takes up to 12 variables.
-
Wires are drawn with automatic right-angle routes from pin to pin; there are no free wire bends or junctions in mid-wire (wire from the pin instead — every wire on a pin is the same net).
-
Parts face right (inputs on the left, outputs on the right) and cannot be rotated.
Linking to an example
Share link packs the circuit into ?s=…. Links can also be written by hand:
| Parameter | Meaning | Example |
|---|---|---|
|
One of the examples below |
|
|
Build a circuit from an expression ( |
|
|
Gate delays on ( |
|
|
Ticks per second |
|
example= |
Opens |
|---|---|
|
Gates tour (open) |
|
Half adder and a full-adder component (open) |
|
4-bit ripple-carry adder (open) |
|
4-bit binary counter from T flip-flops (open) |
|
Traffic light finite-state machine (open) |
|
BCD to 7-segment decoder from gates (open) |
|
The tiny 4-bit CPU counting in threes (open) |
|
SR latch from two NOR gates (open) |
|
A static hazard with gate delays (open) |
|
Ring oscillator (open) |
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.