Something wrong with this tool?
About Bitwise Calculator Online
This tool performs bit-level operations on two integers: AND, OR, XOR, NOT, left shift, right shift, and arithmetic shift. Enter numbers in decimal, hexadecimal, octal, or binary, and the calculator returns the result in all four bases plus the bit pattern.
Bitwise operations are foundational in programming, especially in low-level systems, embedded code, graphics, networking, and cryptography. They are also useful for compact flag/permission storage where each bit represents a boolean property of an object.
The tool is ideal for students learning bit manipulation, developers debugging masks and permissions, and engineers verifying hardware register settings. Showing the binary representation makes the operation's effect visually obvious.
How to use this tool
How to evaluate a bitwise operation on two integers
Enter A and B
"Integer A" and "Integer B" are the two operands. The tool truncates each to an integer with `Math.trunc` before operating — fractional inputs lose their decimals.
Pick the operation
"Operation" selects from `and` (`A & B`), `or` (`A | B`), `xor` (`A ^ B`), `shl` (`A << B`, left shift), `shr` (`A >> B`, right shift).
Press Run
Result returns a single `result` field — a signed 32-bit integer. JavaScript bitwise ops coerce both sides to 32-bit twos-complement, so anything outside [-2^31, 2^31 − 1] wraps around.
Shifts on B as a count
For `shl`/`shr`, only the low 5 bits of B are used as the shift count — so a shift of 32 is the same as a shift of 0. This is JavaScript's behavior, not a bug.