Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
Tonic of Tech Tonic Of Tech
Tonic of Tech Tonic Of Tech
  • Tech News
  • AI
  • Apple
  • Apps
    • Android Apps
    • IOS Apps
  • Blockchain
  • Business
  • Cloud
  • Cloud Computing
  • Cybersecurity
  • Devops
  • Write for Us
  • Fintech
  • Google
  • Guides
  • IoT
  • Machine Learning
  • Laptops
  • Radio Technology
  • Smartphones
    • Android
    • iOS
  • Software
  • Windows
  • Tech News
  • AI
  • Apple
  • Apps
    • Android Apps
    • IOS Apps
  • Blockchain
  • Business
  • Cloud
  • Cloud Computing
  • Cybersecurity
  • Devops
  • Write for Us
  • Fintech
  • Google
  • Guides
  • IoT
  • Machine Learning
  • Laptops
  • Radio Technology
  • Smartphones
    • Android
    • iOS
  • Software
  • Windows
Close

Search

GuidesTech News

What Is a Logic Gate? Types, Truth Tables & Examples

By Jessica Walker
29/11/2026 12 Min Read
0

A logic gate is a tiny electronic circuit that takes one or more binary inputs (0 or 1) and produces a single binary output based on a fixed rule, such as AND, OR, or NOT. Billions of them work together inside every computer, phone, and smart device to make decisions, do math, and store data.

This guide explains how a logic gate works, covers all seven standard types with truth tables, shows how gates become adders and memory, and gives you a small circuit to build. It also covers the mistakes that trip up beginners, which most explanations skip.

Key takeaways

  • A logic gate turns binary inputs into one binary output using a fixed rule.
  • There are seven standard gates: AND, OR, NOT, NAND, NOR, XOR, and XNOR.
  • Think of AND as switches in series and OR as switches in parallel.
  • A truth table lists the output for every possible input combination.
  • NAND and NOR are “universal”: either one can build every other gate.
  • Gates are built from transistors, and a modern processor contains billions of them.

Table of Contents

Toggle
  • What is a logic gate?
    • What’s the easiest way to picture a logic gate?
    • What are inputs, outputs, and truth tables?
  • How does a logic gate work?
  • What are the types of logic gates?
    • What does the combined truth table look like?
    • What is a real-world example of each gate?
    • How do you recognize logic gate symbols?
  • What is Boolean algebra, and how does it simplify gates?
  • Why are NAND and NOR called universal gates?
  • What’s the difference between combinational and sequential logic?
  • What are logic gates made of?
    • How big can it get?
  • Which logic family should you use?
  • What other gate-like parts will you see?
  • What can you build with logic gates?
    • How does a half adder work?
  • How do logic gates relate to programming?
  • How do you build a simple logic gate circuit?
  • What mistakes do beginners make with logic gates?
  • Where did logic gates come from?
  • Where are logic gates used?
  • Try it yourself
  • Frequently Asked Questions
    • What are the 7 basic logic gates?
    • What is a logic gate with an example?
    • Why are NAND and NOR called universal gates?
    • What is the difference between a logic gate and a transistor?
    • Do logic gates only work with 0 and 1?
  • Sources and how this guide was checked

What is a logic gate?

A logic gate is the smallest decision-making unit in digital electronics. It looks at its inputs, applies one rule, and outputs a 1 (true, or “high”) or a 0 (false, or “low”).

Inside a real chip, 0 and 1 aren’t magic numbers. They’re voltage ranges. In classic 5 V TTL chips, an input below about 0.8 V reads as 0, and an input above about 2.0 V reads as 1. In common 74HC CMOS chips, roughly the bottom 30% of the supply voltage reads as 0 and the top 30% reads as 1.

The zone in between is undefined. That detail explains a beginner mistake covered below: leaving an input unconnected.

What’s the easiest way to picture a logic gate?

Picture a lamp wired to a power source through switches. Closed means 1, open means 0, and the lamp is the output.

AND = switches in series            OR = switches in parallel

 +5 V ──[ A ]──[ B ]──( lamp )       +5 V ──┬──[ A ]──┬──( lamp )
                                             └──[ B ]──┘
  • AND: The lamp lights only if both switches are closed, because current has to pass through both.
  • OR: The lamp lights if either switch is closed, because current can take either path.
  • NOT: A normally closed switch. Pressing it breaks the circuit, so a 1 in gives a 0 out.

Early computers worked this way, using electromechanical relays as the switches. Modern gates do the same job with transistors.

What are inputs, outputs, and truth tables?

  • Inputs: The signals going into the gate, usually labeled A and B.
  • Output: The single result, usually labeled Y or Q.
  • Truth table: A chart listing the output for every possible input combination.

Because every input is 0 or 1, the number of rows in a truth table is 2 raised to the number of inputs.

Number of inputsRows in the truth table
12
24
38
416
8256

How does a logic gate work?

Under the hood, a gate is a small group of transistors acting as switches. Here is the sequence for a CMOS NAND gate, the most common building block.

  1. The inputs arrive as voltages, high or low.
  2. Those voltages turn the gate’s transistors on or off.
  3. Two transistors in parallel connect the output to the supply voltage, and two in series connect it to ground.
  4. The output is pulled low only when both inputs are high. In every other case, it’s pulled high.
  5. That output voltage feeds the next gate, which repeats the process.

Each step takes only a few nanoseconds, which is why chains of millions of gates can do their work billions of times per second.

What are the types of logic gates?

There are seven standard logic gates. AND, OR, and NOT are the basic gates. NAND and NOR are the universal gates. XOR and XNOR are the exclusive gates. Some lists also count the buffer, which passes its input through unchanged, as an eighth.

GateOutput is 1 when…Boolean expressionEveryday way to think of it
ANDEvery input is 1Y = A · BBoth switches must be on
ORAt least one input is 1Y = A + BAny one switch is enough
NOTThe input is 0Y = ĀA flip: yes becomes no
NANDNot every input is 1Y = (A · B)′An AND, flipped
NOREvery input is 0Y = (A + B)′An OR, flipped
XORThe inputs are differentY = A ⊕ BExactly one switch is on
XNORThe inputs are the sameY = (A ⊕ B)′A match detector

AND, OR, NAND, and NOR also come with three, four, or more inputs. The rule scales: a 3-input AND outputs 1 only when all three inputs are 1.

What does the combined truth table look like?

For two inputs, here are all six two-input gates side by side. A NOT gate has one input: 0 gives 1, and 1 gives 0.

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

What is a real-world example of each gate?

  • AND: A garage door closes only if the button is pressed and the safety beam is clear.
  • OR: A car’s dome light comes on if any door is open.
  • NOT: An indicator that lights when a door switch is not triggered.
  • NAND: A warning light that stays on unless every safety check passes.
  • NOR: An “all clear” light that comes on only when none of the alarm inputs are active.
  • XOR: Two light switches at opposite ends of a hallway, where flipping either one changes the light.
  • XNOR: A circuit that checks whether two bits are equal.

How do you recognize logic gate symbols?

AND has a flat back and a rounded front, like a capital D. OR has a curved back that comes to a point. NOT is a triangle. A small circle, called a bubble, on the output means “invert,” so a NAND is an AND shape with a bubble.

A bubble on an input means the signal is active-low: it does its job when it’s 0, not 1.

What is Boolean algebra, and how does it simplify gates?

Boolean algebra is the math of true and false. Each gate has an algebra expression, and the rules let you shrink a circuit before you build it.

RuleExpression
IdentityA · 1 = A, and A + 0 = A
NullA · 0 = 0, and A + 1 = 1
Same input twiceA · A = A, and A + A = A
ComplementA · A′ = 0, and A + A′ = 1
Double negation(A′)′ = A
De Morgan’s laws(A · B)′ = A′ + B′, and (A + B)′ = A′ · B′

Here is one in action. Say a circuit calculates (A · B) + (A · B′). Factor out A, and you get A · (B + B′). Since B + B′ always equals 1, the whole thing simplifies to A. Three gates collapse into a wire.

Why are NAND and NOR called universal gates?

Any digital circuit can be built from NAND gates alone, or from NOR gates alone. That’s why they’re called universal.

To build thisFrom NAND gatesHow many NANDs
NOTTie both inputs together1
ANDNAND, then a NAND wired as NOT2
ORInvert each input with its own NAND-as-NOT, then NAND the results3

The OR trick comes from De Morgan’s law: A OR B equals NOT(NOT A AND NOT B). The same rules work in reverse for NOR.

What’s the difference between combinational and sequential logic?

  • Combinational logic: The output depends only on the inputs right now. An adder is combinational. Change the inputs and the output follows.
  • Sequential logic: The output also depends on stored past values. Feed a gate’s output back into its input and the circuit can hold a bit of memory.

Two cross-connected NOR gates make a basic SR latch, the simplest memory cell. Latches and flip-flops are the building blocks of registers and counters.

What are logic gates made of?

Logic gates are made of switches, and today those switches are transistors. The count depends on the gate and the design style.

GateTypical transistors (CMOS)
NOT2
NAND4
NOR4
AND6 (a NAND plus a NOT)
OR6 (a NOR plus a NOT)
XORCommonly 8 to 12, depending on the design

This is why NAND and NOR are cheaper than AND and OR. They skip the extra inversion stage.

Diodes alone can build AND and OR gates, but not a NOT gate, so diode logic is an incomplete family. Transistors add inversion and signal gain, which is why every complete logic family relies on them.

How big can it get?

Scale shows how far this goes. The Intel 4004 processor in 1971 had 2,300 transistors. Apple’s M4 chip has about 28 billion. Many of those are in memory, but the logic is built from the same ideas.

Which logic family should you use?

A logic family is a set of gates built with the same technology, so they share voltage levels and speed. Early integrated circuits used resistor–transistor logic, then diode–transistor logic, then TTL. Today CMOS dominates.

FamilyTechnologyTypical supplyWhat to knowGood for
74LS (TTL)Bipolar transistors5 VClassic and still common in older gear; draws more power than CMOSRepairing or matching vintage designs
74HCCMOS2 V to 6 VLow power; runs from 3.3 V or 5 VGeneral hobby builds
74HCTCMOS with TTL-level inputs5 VAccepts TTL-level signals, so it bridges familiesMixing with TTL parts
4000 seriesCMOSAbout 3 V to 15 V on many partsWide supply range; slower than 74HCBattery or higher-voltage projects
74LVCLow-voltage CMOSAbout 1.65 V to 3.6 VFast; many parts tolerate 5 V inputs3.3 V microcontroller boards

Don’t mix families blindly. Confirm each part’s voltage levels in its datasheet before you connect them.

What other gate-like parts will you see?

  • Buffer: Passes its input through unchanged. It doesn’t alter the logic, but it can strengthen a weak signal so it can drive more inputs.
  • Tri-state gate: Adds a third output state called high impedance, often written Z, where the output is effectively disconnected. This lets many devices share one wire, as long as only one drives it at a time.
  • Schmitt trigger: An input with two different switching thresholds, one for rising signals and one for falling. It cleans up slow or noisy signals, such as a bouncing button. The 74HC14 is a common example.

What can you build with logic gates?

Gates combine into circuits that do useful work.

  • Adders: Add binary numbers.
  • Comparators: Check whether two numbers match.
  • Multiplexers: Pick one of several inputs.
  • Latches and flip-flops: Store a bit of memory.
  • Counters: Count clock pulses.

How does a half adder work?

A half adder adds two single bits. The sum bit is an XOR of the inputs, and the carry bit is an AND of the inputs.

ABSum (A XOR B)Carry (A AND B)
0000
0110
1010
1101

Look at the last row: 1 + 1 equals binary 10, which is sum 0 and carry 1. A full adder chains two half adders and an OR gate to also accept a carry from the previous bit. Chain eight of them and you have an 8-bit adder.

How do logic gates relate to programming?

Every programming language has operators that work like gates. The key detail is the difference between logical and bitwise versions.

GateLogical operator (Python / C-style)Bitwise operator
ANDand / &&&
ORor / |||
NOTnot / !~
XORNo direct logical operator (use != on booleans)^

Bitwise operators apply the gate to every bit at once. For example, 5 is 0101 and 3 is 0011, so 5 & 3 is 1, 5 | 3 is 7, and 5 ^ 3 is 6. That’s eight gates’ worth of work, done in one instruction.

How do you build a simple logic gate circuit?

This beginner build uses a 74HC08 AND chip to prove the truth table with your own hands. The pin numbers follow the standard 74HC08 pinout, so check them against your datasheet.

Parts:

  • One 74HC08 quad AND chip
  • A breadboard and jumper wires
  • A regulated 5 V supply, such as a USB breakout
  • Two push buttons
  • Two 10 kΩ resistors
  • One LED and one 1 kΩ resistor
  • One 0.1 µF capacitor

Steps:

  1. Place the chip across the breadboard’s center gap.
  2. Connect pin 14 to +5 V and pin 7 to ground. Add the 0.1 µF capacitor between them, close to the chip.
  3. Wire each button so one side goes to +5 V and the other side goes to a gate input, pins 1 and 2.
  4. Add a 10 kΩ resistor from each input pin to ground. This pull-down keeps the input at 0 until you press the button.
  5. Connect output pin 3 through the 1 kΩ resistor to the LED’s longer leg. Connect the LED’s shorter leg to ground.
  6. Tie the unused gate inputs (pins 4, 5, 9, 10, 12, and 13) to ground.
  7. Power it up. The LED lights only when you hold both buttons.

Swap in a 74HC32 (OR) or 74HC86 (XOR). They use the same pin layout, so you can rerun the experiment and compare results with the truth table.

No parts? Free browser simulators such as CircuitVerse and Falstad’s circuit simulator let you try the same thing with virtual gates.

What mistakes do beginners make with logic gates?

  • Mixing up OR and XOR. OR is true when one or both inputs are 1. XOR is false when both are 1.
  • Reading NAND and NOR as AND and OR. The “N” flips the output, so the truth table is the opposite.
  • Leaving inputs floating. An unconnected CMOS input can pick up noise and flip randomly. Tie unused inputs to ground or the supply voltage.
  • Skipping the pull-down or pull-up resistor. A button that isn’t pressed shouldn’t leave the input undefined.
  • Ignoring power-pin capacitors. A 0.1 µF capacitor near each chip’s power pins smooths the supply and prevents odd glitches.
  • Mixing voltage levels. Feeding a 5 V signal into a 3.3 V chip that isn’t rated for it can damage the chip.
  • Forgetting propagation delay. Every gate takes a few nanoseconds to respond. When two paths of different lengths meet, the output can briefly glitch before it settles.
  • Overloading an output. The number of inputs one output can drive is called fan-out. Each added input slows the signal a little, and loads like LEDs draw real current. A 1 kΩ resistor in series with the LED keeps a typical 74HC output safe.
  • Letting two outputs fight. If two tri-state outputs drive the same wire at once, the result is undefined and can overheat parts.
  • Misreading active-low signals. A bubble or a name like RESET̄ means the signal acts when it’s 0.

Where did logic gates come from?

YearMilestone
1854George Boole publishes his algebra of true and false
1924Walther Bothe builds an early electronic AND circuit for a physics experiment, and shares the 1954 Nobel Prize in physics for the coincidence method
1937Claude Shannon’s MIT master’s thesis shows that Boolean algebra can describe switching circuits
Mid-1960sTexas Instruments’ 7400 series puts standard gates into inexpensive chips
1971The Intel 4004 puts a full processor on one chip with 2,300 transistors
TodayCMOS dominates, and chips hold billions of transistors

Where are logic gates used?

Logic gates are inside nearly everything electronic:

  • Processors and graphics chips
  • Memory and storage controllers
  • Phones, tablets, and smartwatches
  • Calculators and digital clocks
  • Traffic light controllers and alarm systems
  • Programmable chips like FPGAs, which rearrange gates after manufacturing

Try it yourself

Pick one gate and prove its truth table. Build the AND circuit above, or open a free simulator like CircuitVerse, drop in a gate and two switches, and test all four input combinations.

Then build the half adder from an XOR and an AND. Once you can add 1 + 1 with two gates, you understand the idea behind every processor ever made.

Frequently Asked Questions

What are the 7 basic logic gates?

The seven standard logic gates are AND, OR, NOT, NAND, NOR, XOR, and XNOR. AND, OR, and NOT are the basic gates. NAND and NOR are universal gates because either can build any other gate. XOR outputs 1 when inputs differ, and XNOR outputs 1 when they match.

What is a logic gate with an example?

A logic gate is a circuit that turns binary inputs into one binary output using a fixed rule. For example, an AND gate in a garage-door opener could output 1, meaning close the door, only when the remote button is pressed and the safety sensor is clear. If either input is 0, the output stays 0.

Why are NAND and NOR called universal gates?

Because you can build every other gate, and therefore any digital circuit, from NAND gates alone or from NOR gates alone. A NOT gate is a NAND with its inputs tied together, and AND and OR follow from there. Designers value this because a single repeatable building block keeps designs simple.

What is the difference between a logic gate and a transistor?

A transistor is a tiny electronic switch. A logic gate is a small group of transistors wired together to perform a logical rule. In common CMOS designs, a NOT gate uses two transistors, and a NAND gate uses four. Billions of transistors, grouped into gates, make up a modern processor.

Do logic gates only work with 0 and 1?

Yes, at the logical level. Inside the circuit, 0 and 1 are voltage ranges, not exact values. In a 5 V TTL chip, an input below about 0.8 V reads as 0 and above about 2.0 V reads as 1. Voltages in between are undefined, which is why floating, unconnected inputs can cause erratic behavior.

Sources and how this guide was checked

Definitions, history, and chip counts were checked against the pages below. Voltage thresholds and logic-family traits are standard datasheet-level values and vary by part, so confirm them for your exact chip. The breadboard circuit follows the standard 74HC08 pinout but has not been bench-tested by us.

  • Khan Academy: Logic gates
  • Wikipedia: Logic gate and Digital electronics
  • Keysight: What are logic gates?
  • Rapid Online: What is a logic gate? Types, families and how to choose
  • IEEE Spectrum: Chip Hall of Fame, Intel 4004
  • How Many Transistors Are in a CPU? (Apple chip counts)
Author

Jessica Walker

Jessica Walker is a Tech Writer at Tonic of Tech, where she covers artificial intelligence, AI search tools, consumer electronics, software, and emerging technology trends. Her work is grounded in hands-on research and source verification, focusing on practical guides, product and service comparisons, and clear breakdowns of how AI tools and platforms actually work. Jessica prioritizes accuracy over speculation, distinguishing confirmed product information from general industry practice, and regularly updates her coverage as products, pricing, and the AI landscape evolve.

Follow Me
Other Articles
What Is a VPN Router? How It Works, Pros, Cons & Setup Guide
Previous

What is a VPN router?

Best Small Business Accounting Software (2026 Prices)
Next

Best Small Business Accounting Software (2026 Prices)

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You May Have Missed

Samsung Galaxy S27 Rumors: Standard Models May Miss Out on Ultra Upgrades
Android Smartphones Tech News

Samsung Galaxy S27 Lineup Rumors: Will the Base Models Miss Out on the Ultra’s Boldest Upgrades?

Jessica Walker
By Jessica Walker
03/12/2026
Blog

Healthy Living Habits That Can Improve Your Everyday Lifestyle

Jessica Walker
By Jessica Walker
02/12/2026
Blog

Simple Lifestyle Changes That Can Support Better Health and Wellness

Jessica Walker
By Jessica Walker
02/12/2026
How to Check SSD Health: Windows, Mac & Linux (2026)
Hardware

How to Check SSD Health: Windows, Mac & Linux (2026)

Jessica Walker
By Jessica Walker
02/12/2026
Business

How to Create Career Paths When Job Titles Fall Short

Jessica Walker
By Jessica Walker
02/12/2026
Business

What Makes JUUL Technology a Standout in Modern Pod Vaping?

Za Ghumro
By Za Ghumro
02/12/2026
Business

How Is Advanced Vape Technology Changing the UAE Market?

Za Ghumro
By Za Ghumro
02/12/2026
Business

Budgeting Mistakes to Avoid When Building Healthy Habits

Za Ghumro
By Za Ghumro
30/11/2026
Best Small Business Accounting Software (2026 Prices)
Software

Best Small Business Accounting Software (2026 Prices)

Jessica Walker
By Jessica Walker
29/11/2026
  • Contact Us
  • Disclaimer
  • Home
  • Our Story
  • Privacy Policy
  • Terms & Conditions
  • Your Turn: Write for Us
Copyright 2026 — Tonic Of Tech. All rights reserved.