Do bitwise math at a fixed width and see the result in every base. Enter numbers in decimal, hex, binary or octal, pick AND, OR, XOR, NAND, NOR, NOT or a shift, choose 8, 16, 32 or 64 bits, and get the answer in binary, hex, unsigned and signed form. Click individual bits to flip them. 64-bit values stay exact. It's free and runs entirely in your browser.
| A | B | AND | OR | XOR |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 |
At 8 bits, inverting 00000000 gives 11111111, which is 255 unsigned or −1 signed. Both are shown.
Arithmetic >> keeps the sign bit, so negative numbers stay negative. Logical >>> shifts in zeros.
Yes, exactly. It uses BigInt; ordinary JavaScript bitwise operators only work on 32 bits.
Use 0x for hex, 0b for binary and 0o for octal, or plain digits for decimal.
No. The calculation runs in your browser.
Bitwise results depend on the width of the integer, so every operation here is performed at an explicit 8, 16, 32 or 64 bits. Operands can be typed in decimal, hexadecimal (0x), binary (0b) or octal (0o), including negative numbers, which are taken in two's complement. Arithmetic is done with JavaScript BigInt, so 64-bit values are exact — JavaScript's own bitwise operators silently convert to 32-bit integers and lose the upper half. Each result is masked to the chosen width: NOT 0 at 8 bits is 255, and a left shift drops the bits that fall off the top. Right shift comes in two forms: arithmetic (>>), which copies the sign bit down so negative numbers stay negative, and logical (>>>), which fills with zeros. NAND and NOR are included for logic-design work. Results are shown in grouped binary, hexadecimal and both unsigned and signed decimal, and the bits of the first operand can be flipped by clicking.