💻 Computer Science · Topic 19 of 80

Logic Gates

Gates combine bits using AND, OR and NOT.

Interactive labClick bits to count in binary

About this topic

Logic gates are tiny electronic circuits that take one or more binary inputs and produce one binary output according to a simple rule. The basic gates are AND (output is 1 only if both inputs are 1), OR (output is 1 if at least one input is 1) and NOT (inverts the input). Others include NAND, NOR and XOR.

Gates are built from transistors, and combining them creates every digital circuit. XOR outputs 1 when inputs differ, and together with AND it forms a half adder: XOR gives the sum bit and AND gives the carry. Millions of such gates build the CPU and memory in a chip. NAND is called universal because any other gate can be made using only NAND gates.

A real example is a car warning light that turns on when the door is open AND the engine is running. A common misconception is that gates are only abstract diagrams; they are physical switches that open and close billions of times per second. Learn the truth table of each gate and practise drawing small circuits with them, because it makes later topics like adders and memory far easier.

Key ideas

  1. AND needs both inputs 1
  2. OR needs at least one
  3. NOT flips

Quick check

Use cases: where Logic Gates helps

Computing ideas run phones, search engines, games and the wider internet.

Frequently asked questions

What is Logic Gates?

Gates combine bits using AND, OR and NOT.

What will I learn in Logic Gates?

AND needs both inputs 1. OR needs at least one. NOT flips.

Is Logic Gates part of Computer Science?

Yes. It is one of 80 Computer Science topics on LearnViz HighSchoolEdu, with 3 key ideas, a live animation and a quick check.

Does the Logic Gates lab work on a phone or tablet?

Yes. The animation resizes to fit your screen and supports touch, so you can drag, tap and slide with your finger.

How should I study Logic Gates?

Read the summary and key ideas first, play with the interactive lab to see the idea in motion, then answer the quick check. If you get a question wrong, go back to the key idea it tests.

Do I need an account, and is my progress saved?

No account is needed. Marking a topic as learned is saved in your own browser, so it stays on that device and is not sent to a server.

More in Computer Science