Bitwise Calculator
Do bitwise AND, OR, XOR, NOT and shifts, and see two's complement values in 8, 16, 32 or 64 bits.
About the Bitwise Calculator
Enter two whole numbers, choose an operation (AND, OR, XOR, NOT or a shift) and a bit width. The calculator gives the result in decimal, binary and hexadecimal.
Bitwise operations work on each bit independently and are used for flags, masks, permissions, hashing and low-level programming. Signed integers use two's complement: a negative number −x is stored as 2ⁿ − x, so in 8 bits −1 is 11111111 (255 unsigned).
The formula
−x = (NOT x) + 1; A << n = A × 2ⁿ (within the width)
Worked example
12 AND 10 in 8 bits
- 12 = 0000 1100; 10 = 0000 1010
- Only bit 3 is set in both: 0000 1000
- = 8 (hex 0x8)
Questions people ask
What is 12 AND 10?
8: 1100 AND 1010 = 1000.
Why does NOT 0 give 255?
In 8 bits, every bit flips to 1; read as signed it is −1.