Circuit Logic: AND, OR, NOT and the Basics of Computing

Three gates that built the digital world

1

Logic Gates: The Alphabet of Computing

A logic gate takes one or two inputs (0 or 1) and produces one output. Click the input switches to toggle them and see how each gate responds. Select different gates to compare.

AND: output is 1 only when BOTH inputs are 1.

2

Truth Tables: Every Possible Input

A truth table lists every possible combination of inputs and the resulting output. For two inputs, there are only 4 combinations. Click each row to highlight it on the gate diagram above.

Click a row to see that input combination.

3

Building Up: The Half Adder

Connect gates together and you can compute. A half adder adds two single bits. It uses an XOR gate for the sum and an AND gate for the carry. Click the inputs to add binary numbers.

Click the input switches (A and B) to add two bits.

Sum = A XOR B, Carry = A AND B
0+0=0, 0+1=1, 1+0=1, 1+1=10 (sum=0, carry=1). Chain multiple adders to add bigger numbers. An 8-bit adder uses 8 of these.
4

From Gates to Computers

The same gates you just toggled, manufactured at nanometer scale and connected by the billions, form every digital device on Earth.

Calculators

A basic calculator is a few hundred gates: adders for math, decoders for the display, and control logic for the buttons. The first pocket calculator (1971) had 5,000 transistors.

Memory

A single bit of SRAM uses 6 transistors wired as two cross-coupled inverters. Your computer's cache holds millions of these tiny circuits, each remembering one bit.

CPUs

Apple's M3 chip has 25 billion transistors. Each one is a switch about 3 nanometers wide (15 atoms). Together they execute billions of logic operations per second.

GPUs

A GPU is thousands of small processors running in parallel. Perfect for applying the same logic to millions of pixels or neural network weights simultaneously.

Fun Fact

Claude Shannon proved in 1937 that any mathematical operation can be built from combinations of AND, OR, and NOT gates. He was 21 years old. This insight is the foundation of all digital computing.

Logic Engineer!

You've built computation from the ground up. AND, OR, and NOT gates, combined in layers, create everything from calculators to supercomputers. Every app, game, and AI is logic gates switching on and off billions of times per second.

0
Gates Toggled
0
Circuits Built
0
Time Exploring

Everything Is Binary

Computers only understand two states: on (1) and off (0). Every number, letter, image, and sound is encoded as a sequence of 1s and 0s.

Three Gates Build Everything

AND (both inputs must be 1), OR (either input can be 1), NOT (flips the value). These three gates are functionally complete: any computation is possible.

Gates Combine Into Circuits

Connect gate outputs to other gate inputs and you get circuits. A half-adder (adds two bits) is just an AND gate and an XOR gate.

CPUs Are Billions of Gates

A modern processor has billions of transistors, each acting as a tiny switch. Layers of logic gates process instructions millions of times per second.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction