FreeCircuitSim
April 2026Guided SimulationBeginner

Build Logic Gate Circuits — Step by Step

Logic gates are the building blocks of all digital electronics. This guided simulation walks you through the three fundamental gates — AND, OR, and NOT — step by step, using interactive truth tables and real simulations. Start from zero and finish understanding how all digital circuits work.

What you will learn: How each gate processes binary inputs, how to verify truth tables in simulation, how gates combine to build more complex logic, and how NAND gates can replace all other gate types.

Logic Level Overview

graph LR HIGH["HIGH = 1 = Vcc = True (typically 3.3V or 5V)"] LOW["LOW = 0 = GND = False (typically 0V)"] HIGH -->|"NOT gate"| LOW LOW -->|"NOT gate"| HIGH style HIGH fill:#1a3a2a,stroke:#00ff88,color:#00ff88 style LOW fill:#3a1a1a,stroke:#ff4444,color:#ff4444

Step-by-Step Guide

STEP 1
The NOT Gate — The Simplest Logic

A NOT gate (inverter) has one input and one output. If input is HIGH, output is LOW. If input is LOW, output is HIGH. It flips the logic level.

💡 Logic gates are like light switches with rules: A NOT gate is an automatic switch — when you press it, the light turns OFF (and releasing turns it ON). An AND gate is two switches in series — both must be pressed. An OR gate is two switches in parallel — either one works. Simple mechanical rules, implemented in silicon at billions of operations per second.

Truth table: Input 0 → Output 1 | Input 1 → Output 0

In the simulator, click the input switch. The output LED should turn on when input is off, and off when input is on.

▶ Simulate NOT Gate (CMOS)
Real use: Inverters convert active-HIGH signals to active-LOW and vice versa. They appear everywhere in digital circuits where signal polarity needs flipping — and they are the basis of the NAND gate.
STEP 2
The AND Gate — All Must Be True

An AND gate has two (or more) inputs. Output is HIGH only when ALL inputs are HIGH simultaneously.

Think of it as: two switches in series — both must be closed for current to flow.

Try all four input combinations in the simulator and verify the truth table:

  • A=0, B=0 → Output = 0
  • A=0, B=1 → Output = 0
  • A=1, B=0 → Output = 0
  • A=1, B=1 → Output = 1 ✓ (only this one)
▶ Simulate AND Gate
⚠️ Floating inputs: In a real AND gate IC, unused inputs must be tied to HIGH (Vcc) — NOT left floating. A floating input picks up electrical noise and causes unpredictable output. In simulation, inputs are ideal — in real circuits, they are not.
STEP 3
The OR Gate — Any Input Suffices

An OR gate outputs HIGH when ANY input is HIGH. Output is LOW only when ALL inputs are LOW.

Think of it as: two switches in parallel — either one being closed allows current to flow.

  • A=0, B=0 → Output = 0
  • A=0, B=1 → Output = 1 ✓
  • A=1, B=0 → Output = 1 ✓
  • A=1, B=1 → Output = 1 ✓
▶ Simulate OR Gate
STEP 4
XOR — The Difference Gate

XOR (Exclusive OR) outputs HIGH when inputs are DIFFERENT. When both inputs are the same (both HIGH or both LOW), output is LOW.

XOR is used in binary arithmetic — adding two 1-bit numbers. 0+0=0, 0+1=1, 1+0=1, 1+1=0 (with carry). This is exactly the XOR truth table!

▶ Simulate XOR Gate ▶ Half Adder (XOR + AND)
XOR + AND = Half Adder: One XOR gate gives the sum bit. One AND gate gives the carry bit. Two components add two binary digits. Chain multiple full adders and you have an N-bit adder — the core of every ALU in every CPU.
STEP 5
Build Any Gate from NAND Gates

NAND gates are "universal" — you can build any other gate from them alone. This was crucial in early IC manufacturing: one gate type could implement any logic.

  • NOT from NAND: Tie both NAND inputs together → acts as NOT
  • AND from NAND: NAND gate → NOT gate (NAND with tied inputs)
  • OR from NAND: Invert both inputs, then NAND them (De Morgan's theorem)
▶ NAND SR Flip-Flop
Why this matters in 2026: FPGA design uses hardware description languages (Verilog, VHDL) that describe logic functions at the gate level. The FPGA synthesis tool automatically converts them to the available gate primitives — usually NAND and NOR. Understanding universal gates helps you understand what the synthesiser is doing.
📍 Next project — apply digital knowledge
Continue Learning →
Next: Build an LED Flasher (555 Timer)
Next: LED Flasher →

Frequently Asked Questions

What is the difference between a gate and a flip-flop?
Logic gates are combinational — output depends only on current inputs, with no memory. Flip-flops are sequential — output depends on current inputs AND stored state (previous output). Flip-flops are built from cross-coupled NAND or NOR gates, and they store one bit of information.
What does 74HC stand for in ICs like the 74HC00?
74 indicates the 7400 logic family (commercial temperature range). HC means High-speed CMOS. 00 is the specific gate type (quad 2-input NAND). So 74HC00 is a chip containing four 2-input NAND gates implemented in high-speed CMOS logic, operating from 2V to 6V.
Can I simulate complex digital circuits in FreeCircuitSim?
Yes. The simulator supports full combinational and sequential logic including flip-flops, counters, multiplexers, decoders, shift registers, and even a 4-bit ALU (the 74181). You can build and simulate complete small CPUs using the built-in logic gate primitives.

Frequently Asked Questions

What are the three fundamental logic gates?
AND (output HIGH only when all inputs HIGH), OR (output HIGH when any input HIGH), and NOT (inverts the input). All other gates are combinations of these three. NAND and NOR are also considered fundamental because they are universal — any gate can be built from them alone.
How do I build a NOT gate from transistors?
An NPN transistor in common-emitter configuration acts as an inverter: HIGH input (base current flows, transistor saturates, collector pulled low) gives LOW output. LOW input (no base current, transistor off, collector at Vcc) gives HIGH output. This is the CMOS inverter at a transistor level.
What is Boolean algebra?
Boolean algebra is the mathematical framework for logic gate analysis. Variables are 0 or 1. Operations are AND (multiplication), OR (addition), NOT (complement). De Morgan's theorem states: NOT(A AND B) = (NOT A) OR (NOT B), which is why NAND gates can implement OR functions.
← Back to All Guides