Logic Gate Truth Table
Interactive truth tables for the AND, OR, NAND, NOR, XOR, XNOR and NOT gates: toggle the inputs and watch the output and the full table update.
How to Use
- Pick a gate type: AND, OR, NAND, NOR, XOR, XNOR or NOT.
- Set input A and input B to 0 or 1 (NOT uses only A).
- Read the output and the gate's full truth table, with your current row highlighted.
- Try the presets to see how gates combine, for example in a half adder.
Worked Example
A half adder adds two bits, A = 1 and B = 1. The sum bit is A XOR B = 0 (the inputs are the same), and the carry bit is A AND B = 1. Together they read 10 in binary, which is 2: exactly 1 + 1.
The other three cases: 0 + 0 gives sum 0, carry 0; 0 + 1 and 1 + 0 give sum 1, carry 0.
The common mistake: using OR for the sum. 1 OR 1 = 1 would make 1 + 1 come out as 11 (binary 3). The sum needs XOR, which is 1 only when exactly one input is 1.
Truth Table
Gate Cheatsheet
History of Logic Gates
George Boole published An Investigation of the Laws of Thought in 1854, introducing the algebra of logic that now bears his name — AND, OR, NOT operating on true/false values. Claude Shannon's 1938 master's thesis "A Symbolic Analysis of Relay and Switching Circuits" connected Boolean algebra to electromechanical relays, founding the field of digital circuit design almost single-handedly.
The first practical logic gates were vacuum-tube circuits in computers like ENIAC (1945) and Colossus (1944). Transistor-transistor logic (TTL) was invented in 1961, and Texas Instruments' 5400/7400 series of the mid-1960s made it the standard; CMOS, invented at Fairchild in 1963, reached the market as RCA's 4000 series in 1968. TTL and CMOS remained the dominant discrete-logic families for decades. Today, discrete 74-series logic is rare — most digital function now lives inside FPGAs or full SoCs — but truth tables are still the fundamental tool for describing any digital behavior.
NAND (and NOR) are functionally complete: any Boolean function, no matter how complex, can be implemented using NAND gates alone (or NOR alone). NAND gates are also fast and compact in both TTL and CMOS, which made them the workhorse of many logic families. Modern standard-cell libraries include dozens of gate types for compactness and speed, but the underlying logic-completeness principle is unchanged.
About This Calculator
Pick a gate type and input values (A and B for 2-input gates, just A for NOT). The tool computes Y and shows the full truth table below. Useful for verifying homework, building intuition for new gate types (XNOR, for instance), and quickly looking up unfamiliar equations.
For serious design work, use a proper HDL simulator (Verilog/VHDL with ModelSim, Icarus Verilog, Verilator) or schematic capture with logic simulation (LTspice, Qucs). This calculator is a quick reference, not a synthesis tool. Everything runs client-side; no values leave your browser.
Frequently Asked Questions
Why is NAND called universal?
Any Boolean function can be built from NAND gates alone (and also from NOR alone). For example, a NAND with both inputs tied together is a NOT, and NOT after NAND gives AND.
What is XOR used for?
XOR outputs 1 when its inputs differ. It is the sum bit of a binary adder, the core of parity checks and CRCs, and a handy way to flip a bit under control: X XOR 1 inverts X, X XOR 0 leaves it alone.
What is the difference between OR and XOR?
They differ only when both inputs are 1: OR gives 1 ("either or both") and XOR gives 0 ("one or the other, not both").
What do 0 and 1 mean electrically?
In a logic family they are voltage ranges. For 5 V CMOS, a valid low is up to about 30% of the supply and a valid high from about 70%; voltages in between are undefined and must be avoided at inputs.
What does a half adder do?
It adds two single bits: XOR gives the sum bit and AND gives the carry. 1 + 1 gives sum 0, carry 1, which is binary 10. Chaining full adders (two half adders plus an OR) adds numbers of any width.
How do I use the Logic Gate Truth Table?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Homework and Study
Check truth tables and Boolean answers gate by gate before tackling larger circuits.
Designing Simple Logic
Work out which gate turns two sensor signals into the output you need, for example "alarm if door open AND armed".
Choosing 74-Series Parts
Identify the gate function you need before picking a chip such as a 74HC00 (quad NAND) or 74HC86 (quad XOR).
Understanding Adders and Parity
Use XOR and AND to see how computers add binary numbers and detect single-bit errors.
Last updated: