Binary Logic Gate Calculator (XOR, AND, OR, NOT)
Perform bitwise logic operations on binary numbers. Calculate XOR, AND, OR, and NOT results with a visual truth table. Useful for digital circuit design and programming.
Logic Gate Truth Tables
AND
| A | B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR
| A | B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
XOR
| A | B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NAND
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XNOR
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
About Logic Gates
AND: Output is HIGH (1) only when ALL inputs are HIGH
OR: Output is HIGH when ANY input is HIGH
XOR: Output is HIGH when inputs are DIFFERENT
NAND/NOR/XNOR: Inverted versions of AND/OR/XOR respectively
How It Works
This binary logic gate calculator performs bitwise logical operations (XOR, AND, OR, NOT) on binary inputs. It shows truth tables and step-by-step bit-by-bit calculations for understanding digital logic.
The logic operations:
- AND operation: Output is 1 only if both input bits are 1. Otherwise 0.
- OR operation: Output is 1 if either input bit is 1. Only 0 if both are 0.
- XOR operation: Output is 1 if exactly one input is 1. 0 if both same.
- NOT operation: Inverts each bit: 0 becomes 1, 1 becomes 0.
Truth tables show all possible input combinations: AND (00→0, 01→0, 10→0, 11→1), OR (00→0, 01→1, 10→1, 11→1), XOR (00→0, 01→1, 10→1, 11→0), NOT (0→1, 1→0).
When You'd Actually Use This
Digital Logic Design
Test and verify logic gate combinations for circuit design.
Learning Boolean Algebra
Understand fundamental logic operations and truth tables.
Programming Bit Operations
Master bitwise operators used in low-level programming and optimization.
Computer Architecture Studies
Explore how CPUs implement arithmetic and logic using gates.
CTF Challenge Solving
Solve cryptography and reverse engineering challenges using XOR and other operations.
Mask and Flag Operations
Calculate bit masks and flags for configuration and status registers.
What to Know Before Using
Operations work bit-by-bit
Each bit position is independent. Bit 0 of output depends only on bit 0 of inputs.
Inputs should be same length
For two-input operations, pad shorter input with leading zeros to match lengths.
NOT is a single-input operation
NOT inverts one value. AND, OR, XOR need two inputs. Some tools support NAND, NOR, XNOR too.
XOR is reversible
A XOR B = C means C XOR B = A. This property makes XOR useful for encryption and swapping.
Logic gates build complex circuits
All digital circuits are built from these basic gates. CPUs contain billions of transistors implementing these operations.
Common Questions
What's the XOR truth table?
0 XOR 0 = 0, 0 XOR 1 = 1, 1 XOR 0 = 1, 1 XOR 1 = 0. Output is 1 when inputs differ, 0 when same.
What's the AND truth table?
0 AND 0 = 0, 0 AND 1 = 0, 1 AND 0 = 0, 1 AND 1 = 1. Output is 1 only when both inputs are 1.
What's the OR truth table?
0 OR 0 = 0, 0 OR 1 = 1, 1 OR 0 = 1, 1 OR 1 = 1. Output is 0 only when both inputs are 0.
How is XOR used in encryption?
XOR with a key encrypts: ciphertext = plaintext XOR key. Decrypt: plaintext = ciphertext XOR key. Same operation!
What are NAND and NOR gates?
NAND = NOT AND (inverted AND). NOR = NOT OR (inverted OR). These are 'universal gates' - any logic can be built from just NAND or just NOR.
How do I use AND as a mask?
AND with 1 keeps the bit, AND with 0 clears it. Value AND 00001111 keeps only the lower 4 bits.
What's XNOR?
XNOR is inverted XOR (NOT XOR). Output is 1 when inputs are the same, 0 when different. Equality checker.
Other Free Tools
Binary Bit Flipper & Manipulator
Binary Bit Flipper & Manipulator
Binary to Hexadecimal Converter
Binary to Hexadecimal Converter
Decimal to Binary Converter
Decimal to Binary Converter
Binary Gray Code Converter
Binary Gray Code Converter
Binary to Octal Converter
Binary to Octal Converter
ASCII to Hex Converter
ASCII to Hex Converter: Text to Hexadecimal Translator
Free Printable Calendar Maker
Create & Print Your Custom Calendar
HTML Minifier
Free HTML Minifier & Compressor
Unix Timestamp Converter
Unix Timestamp Converter
Password Generator
Free Strong Password Generator