Skip to content

Bitwise calculator (AND, OR, XOR, shifts)

AND, OR, XOR, NOT and bit shifts on 8-, 16- or 32-bit numbers, with the bits lined up and the two’s-complement value.

Results

Result (unsigned) 8

How it works

A AND B · A OR B · A XOR B · NOT A · A << n · A >> n

Bitwise operations work on each bit position separately. AND gives 1 only where both bits are 1 (handy for masking), OR where either is 1 (setting flags), XOR where they differ (toggling). Shifting left by n multiplies by 2ⁿ, shifting right divides. With a fixed width, the top bit can mean a sign: in two’s complement 1111 1111 is −1 as a signed 8-bit number and 255 unsigned. Negative inputs are stored that way.

  1. Bit by bit A 1100 1010 B 0011 1100 AND 0000 1000