TXT · Text & Data tools

Bitwise Calculator

Operation
Input base
Word size
Operand A
Operand B
expression

0x000000F0 AND 0x0000000F = 0x00000000

32-bit result

0000 0000 0000 0000 0000 0000 0000 0000

Unsigned decimal
0
Hexadecimal
0x00000000
Octal
0o00000000000
ANDoperation32-bitwordautoinput baseUnsigneddecimal

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.

Frequently Asked Questions

The calculator supports AND, OR, XOR, NAND, NOR, XNOR, NOT, shift left, logical shift right, and arithmetic shift right.

Use decimal, binary, octal, or hexadecimal input. Auto mode treats prefixed values like 0b1010, 0o755, and 0xFF as their matching base, then treats unprefixed values as decimal.

NOT and negative values depend on a fixed number of bits. An 8-bit NOT of 0 is 255, while a 32-bit NOT of 0 is 4294967295.

No. Signed output only changes how the fixed-width result is displayed. The bit pattern stays the same.

Looking for a faster, single-purpose workflow?

Specific bitwise operations

Explore Our Tools

Browse all tools