Boneyard Tools

Bitwise Calculator

Run any bitwise operation on two integers at the width you choose. Enter values in decimal, hex, octal or binary and read the result in every base at once.

How to use the bitwise calculator

  1. Pick a bit width: 8, 16, 32 or 64 bits.
  2. Enter the operands in decimal, or with a 0x, 0o or 0b prefix.
  3. Choose an operation such as AND, XOR or left shift.
  4. Read the result in binary, hex, octal and decimal.

Examples

AND two bytes

0xF0 AND 0x0F, 8 bits
0x00, binary 0000 0000

Left shift

1 << 4, 8 bits
0x10, binary 0001 0000, decimal 16

Frequently asked questions

Which bitwise operations are supported?

AND, OR, XOR, NOT, NAND, NOR and XNOR, plus logical left and right shifts. NOT and the shifts use a single operand and a shift amount.

What number formats can I enter?

Decimal by default, or use a 0x prefix for hex, 0o for octal and 0b for binary. Underscores and spaces are allowed as digit separators.

Does it support 64-bit values?

Yes. Calculations run on BigInt, so 8, 16, 32 and 64 bit widths are all exact, including the full unsigned 64-bit range.

How are negative numbers handled?

Enter a negative decimal and it is wrapped into the width using twos complement, so -1 at 8 bits becomes 11111111. Results show both the unsigned and signed value.

Is the right shift arithmetic or logical?

Logical. Operands are treated as unsigned within the chosen width, so a right shift always fills the top bits with zeros.

Is my data sent anywhere?

No. Everything runs in your browser, so the values you enter never leave your device.

Related tools