Bitwise Calculator
Perform AND, OR, XOR, NOT, and bit-shift operations on integers with binary display.
A
255 (dec)
0x000000FF
0000 0000 0000 0000 0000 0000 1111 1111
B
170 (dec)
0x000000AA
0000 0000 0000 0000 0000 0000 1010 1010
Result (A & B)
170 (dec)
0x000000AA
0000 0000 0000 0000 0000 0000 1010 1010
Related Tools
0 comments
How it works
Enter one or two integer operands (decimal, binary with 0b prefix, or hex with 0x prefix). Select the bitwise operation: AND (&), OR (|), XOR (^), NOT (~), left shift (<<), or right shift (>>). The tool shows the operands and result in binary, decimal, and hexadecimal with each bit aligned for easy visual inspection. Computation uses JavaScript's 32-bit integer arithmetic, matching most C/Java environments.
Common use cases
- Checking flag masks and permission bits in systems programming.
- Debugging network subnet masks or protocol bit fields.
- Learning how bitwise operations work by seeing the binary representation step by step.
Frequently asked questions
What integer size is used?
JavaScript's bitwise operators work on 32-bit signed integers, so values are clamped to the range −2,147,483,648 to 2,147,483,647. This matches C int and Java int behaviour.
Can I enter binary or hex values?
Yes — prefix with 0b for binary (e.g. 0b1010) or 0x for hexadecimal (e.g. 0xFF). The tool parses and converts before applying the operation.