🔢Bitwise Calculator - AND, OR, XOR, Shifts and Two's Complement
When you are poking at a register, decoding protocol flags or working out a permission mask, the slow part is not the arithmetic — it is converting between binary, hex and decimal and keeping track of which bit is which. This calculator shows AND, OR, XOR, NAND, clear, complement, both right shifts and the rotates all at once, each result printed as padded binary, hex and decimal. Pick a width of 8, 16, 32 or 64 bits and click the bit cells to flip them. Everything is computed with big integers, so 64-bit results are right where JavaScript's own operators would overflow.
Free · No sign-up · Runs in your browserLast updated:
Loading tool...
How to use Bitwise Calculator
- 1Type values A and B — decimal, or 0x1F, 0b1010 and 0o17 all work
- 2Pick the width, and tick signed if you want to read negatives
- 3Set the shift amount; every result updates as you type
- 4Click the bit cells to flip individual bits of A when building a mask
FAQ
- Why does this differ from my browser console?
- JavaScript converts operands to 32-bit signed integers, so anything wider overflows, and >>> turns negative numbers into very large positive ones. This page uses BigInt truncated to the width you chose, so 64-bit and signed results come out correct.
- What is the difference between >> and >>>?
- Logical shift (>>>) always fills with zeros, which treats the value as an unsigned bit string. Arithmetic shift (>>) fills with the sign bit, so a negative number stays negative — it behaves like a signed division by 2ⁿ.
- How do I test whether a bit is set?
- AND it with a mask: to check bit 3, AND with 1 << 3 = 0b1000 and see if the result is non-zero. OR sets a bit, AND NOT clears it and XOR flips it — all four are listed here already.
- How should I read two's complement?
- The top bit is the sign and a negative value is the complement plus one. In 8 bits 0xFF is both unsigned 255 and signed −1: one bit pattern, two readings. Tick the signed box to see both side by side.