Bitwise Calculator
Calculate bitwise operations on fixed-width integers. Enter one or two operands, pick the operation, and read the result as decimal, hexadecimal, octal, and padded binary.
Fixed-width integer math
JavaScript numbers are floating-point values, but bit work usually needs exact integer bits. This calculator uses BigInt internally, then masks every result to the selected word size. That keeps 8-bit, 16-bit, 32-bit, 64-bit, and 128-bit results predictable.
The word size matters most for NOT, NAND, NOR, XNOR, negative inputs, and arithmetic right shift. NOT 0 does not have one universal value. In an 8-bit word it becomes 11111111, while in a 32-bit word it becomes 32 one bits.
Input bases
Choose a shared input base for both operands. Decimal, binary, octal, and hexadecimal modes validate digits before calculating. Auto mode accepts common prefixes: 0b for binary, 0o for octal, and 0x for hexadecimal. Values without a prefix are read as decimal.
Spaces and underscores are allowed as visual separators, so 1111_0000, FF FF, and 1 024 can be pasted without reformatting.
Signed and unsigned display
The operation always runs on the selected fixed-width bit pattern. The Signed output toggle only changes the decimal interpretation of the final bits.
For example, 0xFF in an 8-bit word is 255 unsigned and -1 signed. The binary and hex output do not change because the stored bit pattern is still 11111111.
Shift operations
Shift left moves bits toward the high end of the word and fills the low end with zeroes. Logical shift right fills the high end with zeroes. Arithmetic shift right preserves the sign bit, which is useful when working with signed two’s-complement values.
Shift counts must be non-negative integers. If the count is greater than or equal to the selected word size, the calculator applies the fixed-width result you would expect: logical shifts clear the word, while arithmetic right shift keeps all ones for negative signed values.