notesonly.in

One notebook for every subject — open it anywhere.

Log in

Logic Gates Guide: OR, AND, NOT, NAND, NOR, XOR, XNOR

Logic gates are electronic circuits that make decisions using binary values 0 and 1. Each gate follows a simple rule, like AND requiring all inputs to be 1, or OR requiring any input to be 1. By combining gates, computers perform arithmetic, memory and control operations.

Every digital device, from a calculator to a smartphone, is built from these small gates. Learning OR, AND, NOT, NAND, NOR, XOR and XNOR gives the language of digital electronics. Truth tables describe each gate completely and remove any confusion.

Key Concepts

  • Binary: 0 means low voltage and false, 1 means high voltage and true. Typical logic levels are 0 V and 5 V or 0 V and 3.3 V.
  • OR gate: Output Y = A + B. Output is 1 if A or B or both are 1.
  • AND gate: Output Y = A · B. Output is 1 only if both inputs are 1.
  • NOT gate: Output is the inverse of input. If A is 0, output is 1.
  • NAND gate: AND followed by NOT. Output is 0 only when both inputs are 1.
  • NOR gate: OR followed by NOT. Output is 1 only when both inputs are 0.
  • XOR gate: Output is 1 when inputs are different.
  • XNOR gate: Output is 1 when inputs are the same. It is XOR followed by NOT.

How It Works

  1. Inputs are applied as high or low voltages to transistor circuits inside the gate.
  2. The internal transistors switch ON or OFF and produce the correct output voltage.
  3. A truth table lists all input combinations: 4 rows for 2 inputs, 8 rows for 3 inputs.
  4. XOR is widely used for addition because its output matches the sum bit of binary addition.
  5. NAND and NOR are called universal because all other gates can be built from them.

Worked Example

Find the output when A = 1 and B = 0 for the main gates. OR: 1 + 0 = 1. AND: 1 · 0 = 0. NAND is opposite of AND, so 1. NOR is opposite of OR, so 0. XOR gives 1 because inputs differ, so 1. XNOR gives 0 because inputs are not equal, so 0. NOT A = 0 and NOT B = 1.

Common Misconceptions

  • OR means only one input: In logic, OR includes the case where both inputs are 1. XOR is the exclusive one.
  • NAND is same as AND: NAND output is inverted; its only 0 output occurs at A = 1, B = 1.
  • NOT gate needs two inputs: NOT has exactly one input and one output.

Real-World Applications

  • Adders and arithmetic units in processors.
  • Decision circuits in washing machines, lifts and traffic controls.
  • Error detection using XOR parity checks.
  • Memory and control logic in digital systems.

Logic gates turn simple true-false rules into hardware decisions. OR, AND and NOT form the base, NAND and NOR give universal building blocks, and XOR and XNOR handle difference and equality in digital circuits.