Logic Gate Calculator

Calculate the output of logic gates (AND, OR, NAND, NOR, XOR, XNOR) based on input values. Understand boolean logic operations.

Output

0

AND gate: Input A = 0, Input B = 0 → Output = 0 (False)

Truth Table

ABOutput
000
010
100
111

How to Use This Calculator

  1. Select input A (0 or 1, False or True).
  2. Select the gate type (AND, OR, NAND, NOR, XOR, XNOR).
  3. Select input B (0 or 1, False or True).
  4. The calculator displays the output and shows a complete truth table for that gate.

Logic Gate Operations

Logic gates perform boolean operations on binary inputs:

AND: A AND B (both must be 1)
OR: A OR B (either can be 1)
NAND: NOT (A AND B)
NOR: NOT (A OR B)
XOR: A ≠ B (exclusive OR)
XNOR: A = B (exclusive NOR, equivalence)

Example: AND gate with A=1, B=0: Output = 0 (both must be 1). XOR gate with A=1, B=0: Output = 1 (inputs differ).

Full Description

Logic gates are the fundamental building blocks of digital electronics. They perform boolean logic operations on binary inputs (0 or 1, False or True) to produce binary outputs. Understanding logic gates is essential for digital circuit design, computer architecture, and programming. All digital devices, from simple calculators to complex computers, are built from combinations of logic gates.

Common logic gates include AND (output 1 only if both inputs are 1), OR (output 1 if either input is 1), NOT (inverts the input), NAND (opposite of AND), NOR (opposite of OR), XOR (output 1 if inputs differ), and XNOR (output 1 if inputs are the same). These gates can be combined to create complex circuits that perform arithmetic, memory storage, and decision-making.

This calculator helps you understand logic gates by calculating outputs for different input combinations. Select inputs and gate type, and it shows the output plus a complete truth table. Use it to learn boolean logic, understand digital circuits, verify gate behavior, or design logic circuits. Logic gates are the foundation of all digital electronics and computing.

Frequently Asked Questions

What are logic gates?

Logic gates are basic building blocks of digital circuits that perform boolean logic operations. They take one or more binary inputs (0 or 1) and produce a single binary output based on the gate type. Common gates include AND, OR, NOT, NAND, NOR, XOR, and XNOR.

What do the different gates do?

AND: Output 1 only if both inputs are 1. OR: Output 1 if either input is 1. NAND: Opposite of AND (output 0 only if both inputs are 1). NOR: Opposite of OR (output 0 if either input is 1). XOR: Output 1 if inputs differ. XNOR: Output 1 if inputs are the same.

How are logic gates used?

Logic gates are combined to create complex digital circuits: adders, multiplexers, memory, processors, and entire computers. They're the foundation of all digital electronics. Understanding gates is essential for digital design and programming.

What is a truth table?

A truth table shows all possible input combinations and their corresponding outputs for a logic gate or circuit. For 2 inputs, there are 4 possible combinations (00, 01, 10, 11). Truth tables help understand gate behavior and verify circuit logic.