Bitwise Calculator
Perform bitwise AND, OR, XOR, NOT, left shift, and right shift operations on integers. Shows binary, decimal, octal, and hex representations with a visual bit display.
A
B
=
Bitwise Operations Reference
Bitwise operations work directly on the binary representation of integers. They are used for permission flags (Unix chmod), network masks (CIDR), hardware register manipulation, and performance-critical arithmetic.
Operations
AND (&) - bit is 1 only if both inputs are 1. Used to mask bits: flags & MASKOR (|) - bit is 1 if either input is 1. Used to set bits: flags | FLAGXOR (^) - bit is 1 if inputs differ. Used to toggle bits: flags ^ TOGGLENOT (~) - inverts all bits. Useful with AND to clear a bit: flags & ~FLAGLEFT SHIFT (<<) - shifts bits left, equivalent to multiplying by 2ⁿRIGHT SHIFT (>>) - shifts bits right, equivalent to integer dividing by 2ⁿ