How this instrument works
Logic gates are the fundamental building blocks of digital circuits — simple devices that take one or more binary inputs (0 or 1, representing low and high voltage) and produce a single binary output according to a fixed rule. Every digital system, from a basic calculator to a modern CPU with billions of transistors, is ultimately built by wiring together enormous numbers of these same handful of gate types.
AND outputs 1 only when both inputs are 1; OR outputs 1 when at least one input is 1; XOR (exclusive OR) outputs 1 when the inputs differ — exactly one is 1, not both. NAND, NOR and XNOR are simply the inverted (NOT) versions of AND, OR and XOR respectively — NAND outputs 0 only when both inputs are 1, NOR outputs 1 only when both inputs are 0, and XNOR outputs 1 when the inputs match.
NAND and NOR each have a special property worth knowing: either one, on its own, is 'functionally complete' — meaning any other logic gate (AND, OR, NOT, XOR, anything) can be built using nothing but multiple copies of just NAND gates, or just NOR gates. This is why real chip fabrication often standardizes on NAND or NOR as the base building block, constructing every other gate type out of them at the transistor level.
This instrument covers all six standard 2-input gates behind one control: pick the gate type, toggle inputs A and B, and the output updates immediately — a fast way to check a truth-table value while designing a circuit, debugging boolean logic in code, or working through a digital-logic homework problem.
- Choose Gate type — AND, OR, XOR, NAND, NOR or XNOR — from the dropdown.
- Toggle Input A to 0 or 1.
- Toggle Input B to 0 or 1.
- Read Output for the result of applying the selected gate to A and B.
- Cycle through all four combinations of A and B (0,0 / 0,1 / 1,0 / 1,1) for a given gate to build its full truth table by hand.
Worked example — AND(1, 1)
Choose Gate type = AND, set Input A = 1 and Input B = 1. Output reads 1. This is the only input combination for which AND outputs 1 — AND requires both inputs to be high, and here both are.
It's the simplest possible entry in the AND truth table, and a useful anchor point: try changing either input to 0 while keeping the gate set to AND, and the output immediately drops to 0, since AND(1,0), AND(0,1) and AND(0,0) all evaluate to 0 — only the all-ones case produces a high output.
Questions
What's the difference between OR and XOR?
OR outputs 1 whenever at least one input is 1 — including when both inputs are 1 (OR(1,1) = 1). XOR (exclusive OR) outputs 1 only when the inputs differ from each other — exactly one is 1 and the other is 0 — and outputs 0 when both inputs match, including when both are 1 (XOR(1,1) = 0). The two gates agree on three of the four possible input combinations and disagree only on the (1,1) case, which is the one place 'inclusive' OR and 'exclusive' OR genuinely diverge.
Why are NAND and NOR called 'universal' gates?
NAND and NOR are each functionally complete: using only NAND gates (or only NOR gates), wired together in different combinations, you can construct every other basic gate — NOT, AND, OR, XOR, and so on. For example, tying both inputs of a NAND gate together produces a NOT gate. This universality is why real digital chips are often built from a single repeated NAND or NOR cell at the transistor level rather than needing a separate physical design for every gate type.
How do NAND, NOR and XNOR relate to AND, OR and XOR?
Each is simply the logical NOT (inversion) of its counterpart, applied to the same two inputs: NAND = NOT(AND(A,B)), NOR = NOT(OR(A,B)), and XNOR = NOT(XOR(A,B)). Practically, that means for any pair of inputs, NAND's output is always the opposite of AND's output for those same inputs, and likewise for the OR/NOR and XOR/XNOR pairs — flip the 'N' variant's output and you get the original gate's answer.
What does XNOR(1,0) equal, and why?
XNOR(1,0) = 0. XNOR outputs 1 when its two inputs match (both 0 or both 1) and 0 when they differ. Since 1 and 0 are different values, XNOR outputs 0 here — the same logic as saying XOR(1,0) = 1 (the inputs differ) and then inverting that XOR result to get XNOR's answer of 0.
How many input combinations does a 2-input logic gate have?
Exactly four: (0,0), (0,1), (1,0) and (1,1) — every pairing of two binary values. A gate's full truth table lists the output for all four combinations, and any 2-input logic gate (there are 16 possible ones mathematically, though only a handful like AND, OR, XOR, NAND, NOR and XNOR see common practical use) is completely and uniquely defined by which output it produces for each of these four rows.