Bitwise Calculator

Use &, |, ^, ~, << and >> on decimal numbers and see the binary result.

Free · Runs in your browser · Your text is never uploaded

A hexadecimal sum worked out into a result

Bitwise operators

& keeps bits set in both numbers, | keeps bits set in either, ^ keeps bits that differ, ~ flips all bits, and << / >> shift bits left or right.

Example

12 & 10 is 8, because 1100 AND 1010 is 1000.

Reading the results

Switch the base to hexadecimal to work with masks such as 0xFF, or to binary to see each bit. Remember that AND keeps bits set in both numbers, OR keeps bits set in either, and XOR keeps bits that differ. For a complete walkthrough, read bitwise operators explained.

Practice examples

Try 0xFF & 0x0F to isolate the low four bits, 1 << 7 to make the top bit of a byte, 6 ^ 3 to see XOR in action and ~0 to see how negative numbers appear. Switch the base to binary to watch the bits change.

Need more options? Open the full Hex Calculator.

Related guides

Frequently asked questions

What does ~ give for negative numbers?

~5 is -6, following two’s complement rules on unlimited-width integers.

How do I use hex numbers?

Put 0x in front, such as 0xFF & 0x0F.