This is a hex bitwise calculator. Enter A and B as hex, decimal, or binary, pick AND / OR / XOR / NAND / NOR / XNOR / NOT / SHL / SHR / ASR, and see hex, decimal, and binary together. 0xB7 AND 0x0F at 8 bits is 0x07.
Click a bit on A or B to flip it.
A
B
Result
Click a value to copy it
AND, OR, XOR, NAND, NOR, XNOR, NOT for the same A and B
Truth table (click a row to load A and B)
| A | B | AND | OR | XOR | NAND | NOR | XNOR | NOT A |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
Examples — click a swatch
This page runs bitwise AND, OR, XOR, NAND, NOR, XNOR, NOT, SHL, SHR, and ASR on two integers and shows the same result as hex, unsigned decimal, signed decimal, and grouped binary. Width can be Auto, 8, 16, 32, or 64 bits. 0xB7 AND 0x0F at 8 bits is 0x07. 0xCC AND 0xAA is 0x88. 0x2E AND 0x4A is 0x0A. AND, OR, XOR, NAND, NOR, XNOR, NOT, SHL, SHR, ASR, HEX stay untranslated.
Values are masked to the width. A shift amount ≥ width is treated as 0. Logical SHR fills with zeros; ASR copies the sign bit: 0x80 SHR 4 at 8 bits is 0x08, ASR is 0xF8. NAND is NOT(AND), NOR is NOT(OR), XNOR is NOT(XOR). This is not the hex compare Hamming tool and not a walk-through of two’s complement.
NOT flips every bit in the width, so leading zeros become ones. NOT 0x0F is 0xF0 at 8 bits and 0xFFFFFFF0 at 32 bits.
SHR is logical: new high bits are 0. ASR is arithmetic: new high bits copy the old sign bit so a negative pattern stays negative.
Yes. Switch the format under A or B. The bit grid and the three result fields stay in sync.