Logic Gates

Logic Gate Simulator

English

Half Adder

Use the bench

  1. Load a preset, or drag a component from the left onto the canvas. A click arms a component; the next click on empty canvas places it.
  2. Click an input to switch it between 0 and 1. Select a clock to change its rate, or pause the pulse.
  3. Click an output pin, then an input pin, to connect them. You can also drag from the output pin to the input pin.
  4. A high signal glows cyan and carries a moving pulse. A low signal stays a plain slate line.
  5. Click a node or a wire and press Delete or Backspace, or right-click it, to remove it. Undo steps back. Reset reloads the preset. Clear empties the canvas.
  6. The table on the right lists every input combination for a combinational circuit and marks the live row. Latches and counters show the live state instead.
  7. Export JSON downloads the circuit. Copy JSON puts the same text on the clipboard. Import JSON loads a file or pasted text after a schema check.

How a signal settles

Each pass reads the wires and writes a new output for every gate. The pass repeats until nothing changes. Feedback inside the SR latch and the 2-bit counter is allowed. If a loop never settles, propagation stops and the previous stable values are kept.

Gate reference

These seven elements are the whole parts bin. Two-input gates are the ones you place from the toolbar. The counter preset also uses three-input NAND gates inside each flip-flop.

AND

The output is 1 only when every input is 1. Use it for carry logic and for enable conditions.

Y = A · B

ABY
000
010
100
111

OR

The output is 1 when any input is 1. The alarm circuit uses OR to combine the door and window sensors.

Y = A + B

ABY
000
011
101
111

XOR

The output is 1 when the inputs differ. Sum bits in the adders are XOR chains.

Y = A ⊕ B

ABY
000
011
101
110

NAND

AND followed by NOT. The output is 0 only when every input is 1. The counter is built from NAND gates.

Y = ¬(A · B)

ABY
001
011
101
110

NOR

OR followed by NOT. The output is 1 only when every input is 0. The SR latch is a pair of cross-coupled NOR gates.

Y = ¬(A + B)

ABY
001
010
100
110

NOT

One input. The output is the opposite bit. The mux uses NOT to build the select-low path.

Y = ¬A

AY
01
10

LED

A probe, not a logic operator. It glows green or amber when the input is 1 and stays dark when the input is 0.

Lamp = In

InLamp
00
11

Built-in circuits

Choose a preset to replace the canvas. Half Adder is loaded on the first visit, with A high, so the sum lamp and its wire are already live.

Half Adder

Adds two bits and has no carry input.

Sum is the XOR of A and B. Carry is their AND. The live row in the toolbar table matches the switches on the canvas.

Sum = A ⊕ B, Carry = A · B

ABSumCarry
0000
0110
1010
1101

Full Adder

Adds two bits plus a carry-in.

The first XOR forms A ⊕ B. The second XOR folds in Cin to make Sum. Cout is the OR of the two AND terms that can produce a carry.

Sum = A ⊕ B ⊕ Cin, Cout = (A · B) + (Cin · (A ⊕ B))

ABCinSumCout
00000
00110
01010
01101
10010
10101
11001
11111

SR Latch

Two NOR gates hold one stored bit.

S high and R low sets Q to 1. S low and R high resets Q to 0. Both low keeps the stored bit. Both high is invalid and drives both outputs low. The table is a worked trace, not a combinational listing, because the same inputs can hold either state.

Q = NOR(R, Q̄), Q̄ = NOR(S, Q)

SRQQ̄
0010Stored 1
0101Reset
0001Hold
1010Set
0010Hold
1100Invalid

2-Bit Counter

Two falling-edge T flip-flops, each built from NAND gates and a clock inverter.

T of the low bit is tied high, so Q0 changes on every falling clock edge. T of the high bit is Q0, so Q1 changes only when Q0 was 1 during the high half of the clock. The count Q1 Q0 walks 00, 01, 10, 11.

Q0 toggles when T = 1, Q1 toggles when T = Q0

StepQ1Q0
—00
101
210
311
400

2:1 Mux

Sel chooses which data bit reaches the lamp.

Sel low passes D0. Sel high passes D1. The idle data input is gated off by an AND.

Y = (D0 · ¬Sel) + (D1 · Sel)

D0D1SelY
0000
0010
0100
0111
1001
1010
1101
1111

Alarm Gate

A small interlock: the lamp lights only when the system is armed and at least one sensor is active.

Door and Window are combined with OR. That sensor term is then AND-ed with Armed.

Alarm = Armed · (Door + Window)

ArmedDoorWindowAlarm
0000
0010
0100
0110
1000
1011
1101
1111

Questions

Do I need an account?

No. The bench runs in your browser. There is no signup, and a circuit is not uploaded unless you export the file yourself.

Which parts can I place?

Inputs, a clock, AND, OR, XOR, NAND, NOR, NOT, and an LED probe.

How do I connect two parts?

Click an output pin and then an input pin, or drag from the output pin to the input pin. A high wire glows and carries a moving pulse. A low wire stays a slate line.

Why do the latch and the counter not list every input row?

They store state. The same inputs can produce different outputs, so a combinational table would be misleading. The panel shows the live inputs, the clock, and the lamps. Combinational circuits with up to five inputs still get every row.

How do I save a circuit?

Export JSON downloads a file. Copy JSON puts the same text on the clipboard. Import JSON checks the file and places it on the canvas.

What works with JavaScript disabled?

The canvas stays inactive. The language menu, the gate tables, and the notes for all six built-in circuits remain on the page.

Circuit JSON

A circuit file is version 1. Each node has an id, a type, and coordinates. Inputs and clocks store a 0 or 1. A clock may also store hz. An LED may set led to green or amber. A wire runs from an output pin (pin 0) to one input pin. Each input pin accepts a single wire.

Types: INPUT, CLOCK, AND, OR, XOR, NAND, NOR, NOT, LED.

{
  "version": 1,
  "name": "probe",
  "nodes": [
    {
      "id": "a",
      "type": "INPUT",
      "x": 40,
      "y": 80,
      "label": "A",
      "value": 0,
      "output": 0
    },
    {
      "id": "y",
      "type": "LED",
      "x": 240,
      "y": 72,
      "label": "Y",
      "led": "green",
      "output": 0
    }
  ],
  "wires": [
    {
      "id": "w1",
      "from": {
        "id": "a",
        "pin": 0
      },
      "to": {
        "id": "y",
        "pin": 0
      }
    }
  ]
}

Affiliate disclosure

Links for Surfshark and Corel are affiliate links. If you buy through them, we may earn a commission at no extra cost to you.

Paste circuit JSON

Paste a circuit file. The schema is checked before it is placed on the canvas.