All labs › Learn › Digital Logic Design
All articlesAll labs

Logic Gates and Truth Tables: AND, OR, NOT, NAND, NOR, XOR

Learn the seven basic logic gates with truth tables, symbols and expressions, the common TTL chips that hold them and how to read a gate level circuit.

Updated 28 November 2026 · 4 min read · Designed by Fasih Ullah Saleem

01Digital signals have two values02The basic gates03Truth tables of two input gates04Thinking about each gate05Reading a circuit06Real gates have delay07Try it in the virtual lab08Questions and answers09Related topics
01

Digital signals have two values

A digital circuit works with signals that have only two meaningful levels, called logic 0 and logic 1. In a TTL circuit powered from 5 V, an output at logic 0 is below 0.4 V and an output at logic 1 is above 2.4 V, usually near 3.4 V. A logic gate takes one or more of these inputs and makes an output that depends only on them.

A truth table lists the output of a gate for every possible input combination. With n inputs there are 2^n rows, so a two input gate has four rows. Truth tables are the plain way to say exactly what a circuit does.

02

The basic gates

GateExpressionOutput is 1 whenTTL chip
NOTY = A'the input is 07404 (6 gates)
ANDY = A · Ball inputs are 17408 (4 gates)
ORY = A + Bat least one input is 17432 (4 gates)
NANDY = (A · B)'not all inputs are 17400 (4 gates)
NORY = (A + B)'all inputs are 07402 (4 gates)
XORY = A ⊕ Bthe inputs are different7486 (4 gates)
XNORY = (A ⊕ B)'the inputs are the same74266 (4 gates)

The apostrophe means NOT. A dot means AND and a plus sign means OR. Remember that the plus sign is not addition here.

03

Truth tables of two input gates

This table shows the output of each gate for the four input pairs.

ABANDORNANDNORXOR
0000110
0101101
1001101
1111000

NAND is the opposite of AND on every row. NOR is the opposite of OR on every row. XNOR is the opposite of XOR.

04

Thinking about each gate

  • AND is a series switch. Current flows only if A and B are both on.
  • OR is a parallel switch. Current flows if either is on.
  • NOT inverts. A double inversion returns the original value.
  • XOR is a difference detector. With many inputs it gives 1 when an odd number of inputs are 1, so it is used to build parity checkers and adders.
  • A NAND or NOR with its inputs tied together acts as a NOT gate.

An enable input shows how gates are used. An AND gate with A as the data and B as the enable passes A when B is 1, and gives 0 when B is 0. An OR gate with enable low passes the data, and gives 1 when the enable is high.

05

Reading a circuit

To find what a circuit does, write the output of each gate in terms of its inputs, from the left to the right. Then build the truth table by trying all input rows and following the signal.

Y = (A · B) + C'
rows: ABC = 000 → Y = 1,  010 → 1,  100 → 1,  110 → 1,  001 → 0,  011 → 0,  101 → 0,  111 → 1

Check the last row: A = 1, B = 1 gives A · B = 1, so Y = 1 whatever C is. Check a middle row: A = 1, B = 0, C = 1 gives A · B = 0 and C' = 0, so Y = 0.

06

Real gates have delay

Gates are not instant. A standard 7400 series gate takes about 10 ns for its output to change, which is called the propagation delay. In a circuit with many gates in a chain, the delays add up. If two paths of different length meet at one gate, the output can show a short wrong pulse, called a glitch, before it settles.

For a lab, the delay is too small to see with switches and LEDs. It matters when you use a fast clock or when you look at the waveforms on an oscilloscope.

07

Try it in the virtual lab

SinBench has free 3D benches and interactive demos for this topic. Open one to try the ideas above with real instruments, no sign up needed.

Lab 1

Logic Gates and Boolean Theorems

Open the lab →Concepts and demos
08

Questions and answers

What is a truth table?

It is a table that lists the output of a circuit for every combination of inputs. A circuit with n inputs has 2^n rows.

What is the difference between OR and XOR?

OR gives 1 if any input is 1, including when both are 1. XOR gives 1 only when the inputs are different.

Which chip contains four 2 input NAND gates?

The 7400 contains four 2 input NAND gates in one 14 pin package. Pin 14 is the supply and pin 7 is ground.

How do you make a NOT gate from a NAND gate?

Connect both inputs of the NAND gate together. The output is then the opposite of the input.

09

Related topics

Digital Logic Design

Boolean Algebra and De Morgan's Laws

Learn the Boolean identities, absorption and consensus, and De Morgan's laws, with worked simplification examples and truth table proofs you can check.

Digital Logic Design

NAND and NOR as Universal Gates

See why NAND and NOR are universal gates. Build NOT, AND, OR and XOR from NAND only and from NOR only, count the gates and use two level NAND logic.

Digital Logic Design

TTL Chips on a Breadboard: Power, Pin Numbers and Wiring Rules

A practical guide to wiring TTL chips on a breadboard: supply voltage, pin numbering, unused inputs, logic levels, LED resistors and common mistakes.

SinBench SinBench · Free virtual labsDesigned by Fasih Ullah Saleem
© 2026 Fasih Ullah Saleem. All rights reserved. fasihullahsaleem.com · About · Terms of Use · Privacy