Bitwise Calculator
AND, OR, XOR, NOT and bit shifts on 32-bit integers, with a live bit-by-bit visualization
Operands
Operation
Result
12 & 1032-bit pattern of the result
Values are treated as 32-bit integers. The signed decimal interprets the top bit as a sign (two's complement); the unsigned decimal treats all 32 bits as a positive magnitude. The right shift is logical (zeros fill from the left).
About this tool
The bitwise calculator lets developers and computer-science students compute AND, OR, XOR, NOT, and left/right bit shifts on two integers. Enter each operand in binary, decimal, or hexadecimal and the result is shown in all three bases at once, together with a live 32-bit map so you can see exactly which bits flip. It is built for debugging flags and bitmasks, working with permissions, packing data, and learning how computers manipulate bits at the lowest level.
How to use
- 1 Enter Operand A and choose its base (binary, decimal, or hex).
- 2 Pick an operation: AND, OR, XOR, left/right shift, or the unary NOT.
- 3 For two-operand operations enter Operand B; for a shift enter how many bits to shift.
- 4 Read the result in decimal, unsigned, hex, and binary, and inspect the highlighted bits.
How it works
Bitwise operations work on each of the 32 bits independently. AND sets a result bit to 1 only when both input bits are 1, so it is used to mask (keep) selected bits. OR sets a bit to 1 when either input bit is 1, so it is used to turn flags on. XOR sets a bit to 1 only when the two input bits differ, which makes it perfect for toggling and for simple checksums. NOT is unary: it flips every bit, turning 0 into 1 and 1 into 0. A left shift (<<) moves all bits toward the most significant end and fills the gaps with zeros, which multiplies by two for each position; a logical right shift (>>) moves bits the other way and fills with zeros. Because negative numbers are stored in two's complement, the same 32 bits can be read as a signed value (top bit is the sign) or as an unsigned value, which is why this tool shows both. For example 12 AND 10 = 8, 12 OR 10 = 14, 12 XOR 10 = 6, 1 << 4 = 16, and NOT 0 is all ones, which is -1 signed or 4294967295 unsigned.
Frequently asked questions
What is the difference between AND, OR, and XOR?
AND keeps a bit only when both operands have it set, so it is used to clear or test bits with a mask. OR sets a bit when either operand has it, so it is used to turn bits on. XOR sets a bit only when exactly one operand has it, which toggles bits and detects differences.
Why does NOT 0 show -1 and also 4294967295?
NOT flips all 32 bits, so 0 becomes thirty-two 1s. Read as a signed two's-complement integer that pattern is -1; read as an unsigned 32-bit integer it is 4294967295. Both describe the same bits.
What does shifting left or right actually do?
A left shift by n moves every bit n places toward the most significant end and fills with zeros, multiplying by 2 to the power n. A logical right shift by n moves bits the other way and fills with zeros, dividing by 2 to the power n for non-negative values.
Why is everything limited to 32 bits?
JavaScript's bitwise operators and most CPU integer registers work on 32-bit words, so this tool mirrors that. Shift amounts are taken modulo 32, and values wrap within the 32-bit range, exactly as they would in C, Java, or JavaScript.
Related tools and uses
To convert a single value between binary, octal, decimal, and hex, use the number base converter. For character codes see the ASCII converter, and for color masks try the color code converter.