Bitwise Calculator

AND, OR, XOR, NOT, and bit shifts on 32-bit integers — every result in binary, decimal, and hex.

How to use the bitwise calculator

  1. Enter A and B. Type each value and pick its base — try binary “1100” and “1010” to see the classic example.
  2. Set the shift amount. A whole number from 0 to 31, used for A ≪ and A ≫.
  3. Press Calculate. All six operations appear at once, each in binary (grouped in fours), decimal, and hex — with a one-line explanation of what the operation does.
  4. Check edge cases. NOT 0 gives all-ones (4,294,967,295); 1 ≪ 31 is the largest single set bit.

Frequently asked questions

What does a bitwise AND do?

It compares two numbers bit by bit: each result bit is 1 only where BOTH inputs have a 1. For example, 12 AND 10 = 8, because only one shared 1-bit survives.

How is XOR different from OR?

OR sets a bit if either input has it; XOR sets a bit only where the inputs DIFFER. So 12 XOR 10 = 6, while 12 OR 10 = 14.

Why does NOT turn 0 into 4,294,967,295?

This calculator works on 32-bit values, and NOT flips every one of those 32 bits. All-zeros flipped becomes all-ones, which is 2^32 − 1 = 4,294,967,295.

What happens to bits shifted past 32?

They are dropped — shifting wraps modulo 2^32, so bits that fall off the high end are lost and zeros fill in from the low end on a right shift.

How do I read the binary output?

All 32 bits are shown, grouped in fours (nibbles) to make them scannable: each group is one hex digit, so 0000 1100 is 0x0C, or 12.

More from the codex