Perform bitwise AND, OR, XOR, NOT, NAND, NOR and shifts on integers, with decimal, binary and hexadecimal results.
Result (decimal)
How to use this tool
Enter two whole numbers A and B.
Choose AND, OR, XOR, NAND, NOR, NOT, left shift or right shift.
Choose 8, 16 or 32 bits for the binary and hex display.
Read decimal, binary and hexadecimal results.
Formula & worked example
12 AND 10 is 8 (00001000 in binary); 12 OR 10 is 14, 12 XOR 10 is 6, and NOT 12 is -13.
Limitations — read this before you rely on it
32-bit signed integer semantics only: inputs beyond that range wrap, and fractional inputs are rejected.
Frequently asked questions
The standard way computers store negative integers: NOT flips every bit, so ~12 becomes -13 in 32-bit signed arithmetic.
So the result fits the chosen width; the decimal result still shows the full signed value.
Left shift multiplies by powers of two, right shift divides by powers of two, dropping dropped bits.
NOT-AND and NOT-OR: the negations of AND and OR, used heavily in digital logic.
JavaScript bitwise operators work on 32-bit signed integers, so this tool matches that standard behaviour.
