What Is a Logic Gate? Types, Truth Tables and Real-World Uses

By · November 26, 2026
Macro photo of a black circuit board

An easy guide to logic gates for students and tech enthusiasts: definition, binary inputs, the seven basic gates with truth tables, universal gates, combined circuits and everyday applications.

Quick answer: A logic gate is a basic electronic circuit that takes one or more binary inputs (0 or 1, off or on) and produces a single binary output according to a fixed rule from Boolean algebra. The seven basic gates are AND, OR, NOT, NAND, NOR, XOR and XNOR. Logic gates are built from transistors and combined in huge numbers to create processors, memory and other digital circuits that make computers, phones and smart devices work.

Every time you press a key, open an app or stream a video, billions of tiny switches inside your device are making simple yes-or-no decisions. Those decisions are made by logic gates.

Understanding logic gates is a foundation of computer science, electronics and digital engineering. This guide explains what a logic gate is, how binary logic works, each of the seven basic gates with its truth table, why NAND and NOR are called universal gates, and where logic gates are used in the real world.

In this article

How do logic gates work?

Digital electronics represent information using two states: 1 (high voltage, true, on) and 0 (low voltage, false, off). A logic gate receives these signals as inputs and outputs a 1 or 0 based on a rule. The rules come from Boolean algebra, a branch of logic developed by the 19th-century mathematician George Boole.

Physically, modern logic gates are built from transistors, usually in CMOS technology, etched onto silicon chips. A modern processor contains billions of transistors forming enormous networks of gates.

Example
A simple car alarm uses AND logic: the alarm sounds only if the car is locked AND a door is opened. If either condition is false, the alarm stays quiet.

What is Boolean logic?

Boolean logic is a system of reasoning that works with only two values: true and false. George Boole introduced it in the mid-1800s as a way to express logical statements mathematically. Nearly a century later, engineer and mathematician Claude Shannon showed that Boolean algebra could be used to design electrical switching circuits, an idea that became the foundation of digital computing.

In Boolean algebra, AND is often written like multiplication, OR like addition and NOT as a bar or apostrophe. These expressions let engineers describe, simplify and test circuits on paper before building them. Simplifying a Boolean expression can reduce the number of gates needed, making chips smaller, cheaper and more energy efficient.

What are the seven basic logic gates?

1. AND gate

Outputs 1 only if all inputs are 1.

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

2. OR gate

Outputs 1 if at least one input is 1.

A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1

3. NOT gate (inverter)

Has one input and outputs the opposite.

A NOT A
0 1
1 0

4. NAND gate

“Not AND”: the output is 0 only when all inputs are 1; otherwise it is 1. It is the opposite of AND.

A B A NAND B
0 0 1
0 1 1
1 0 1
1 1 0

5. NOR gate

“Not OR”: the output is 1 only when all inputs are 0.

A B A NOR B
0 0 1
0 1 0
1 0 0
1 1 0

6. XOR gate (exclusive OR)

Outputs 1 when the inputs are different.

A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0

7. XNOR gate (exclusive NOR)

Outputs 1 when the inputs are the same. It is often used to check equality.

A B A XNOR B
0 0 1
0 1 0
1 0 0
1 1 1

Logic gates at a glance

Gate Rule in plain English Boolean expression
AND True only if all inputs are true A · B
OR True if any input is true A + B
NOT Reverses the input A̅
NAND False only if all inputs are true (A · B)̅
NOR True only if all inputs are false (A + B)̅
XOR True if inputs differ A ⊕ B
XNOR True if inputs are the same (A ⊕ B)̅

Why are NAND and NOR called universal gates?

NAND and NOR are called universal gates because any other logic gate, and therefore any digital circuit, can be built using only NAND gates or only NOR gates. For example, connecting both inputs of a NAND gate together creates a NOT gate, and adding a NOT after a NAND creates an AND gate. This makes manufacturing simpler and more efficient, which is why NAND-based designs are so common, including in NAND flash memory used in SSDs and USB drives.

BTS Magazine Tip
To remember the gates quickly, learn AND, OR and NOT first. Every other gate is either a combination of these or one of them followed by NOT.

How are logic gates combined into circuits?

Single gates make simple decisions, but combining them creates powerful circuits:

  • Half adder: an XOR gate gives the sum and an AND gate gives the carry when adding two bits
  • Full adder: combines half adders to add bits with a carry-in, the basis of arithmetic in processors
  • Multiplexer: selects one of several inputs to pass to the output
  • Flip-flops and latches: store a single bit, forming the basis of memory and registers
  • Arithmetic logic unit (ALU): the part of a CPU that performs maths and logic operations
Example
When a calculator adds 1 + 1, logic gates inside the chip compute it in binary: 1 XOR 1 = 0 for the sum digit, and 1 AND 1 = 1 for the carry, giving binary 10, which is 2.

Software algorithms ultimately run on these hardware circuits, turning high-level instructions into billions of gate operations.

How can students learn logic gates easily?

  1. Start with real-life statements: “I will go out if it is sunny AND I have finished homework.”
  2. Memorise the three core gates (AND, OR, NOT) and their truth tables.
  3. Learn each “N” gate as the core gate followed by NOT.
  4. Practise drawing gate symbols and labelling inputs and outputs.
  5. Use free online logic simulators to build and test circuits.
  6. Combine gates to build a half adder, then a full adder.
  7. Check answers by writing out full truth tables for each circuit.

Practising a few circuits by hand helps much more than reading alone, because it builds an intuitive feel for how signals move through a system.

Where are logic gates used in real life?

  • Computers and smartphones: processors, memory and graphics chips
  • Calculators: binary arithmetic circuits
  • Home appliances: washing machine and microwave controllers
  • Cars: engine control units, airbags and safety systems
  • Security systems: alarms that combine sensor inputs
  • Traffic lights: sequencing and timing control
  • Internet of Things devices: smart sensors and controllers; see our IoT examples
  • Networking equipment: routers and switches processing data packets

Free learning resources such as Khan Academy’s computing courses and BBC Bitesize explain logic gates with interactive examples.

Try this today
Write the truth table for a two-input XOR gate from memory, then design a simple “two-switch hallway light” using XOR: flipping either switch changes the light.

Frequently Asked Questions

What is a logic gate in simple terms?

A tiny electronic switch circuit that takes binary inputs (0 or 1) and gives a single output based on a logical rule.

How many types of logic gates are there?

There are seven basic logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR.

What is a truth table?

A table listing every possible input combination for a gate or circuit and the resulting output.

Which logic gate is the most important?

NAND is often considered the most important because it is universal and widely used in chip manufacturing.

What are logic gates made of?

Modern logic gates are built from transistors, usually in CMOS technology on silicon chips.

Are logic gates taught in school?

Yes. Logic gates appear in computer science, electronics and digital technology courses at school and university level.

Final Thoughts

  • Logic gates make binary decisions using Boolean rules.
  • The seven basic gates are AND, OR, NOT, NAND, NOR, XOR and XNOR.
  • Truth tables show every input and output combination.
  • NAND and NOR are universal gates that can build any circuit.
  • Combined gates create adders, memory and entire processors.

Explore More on BTS Magazine