Bitwise Calculator
NewPerform AND, OR, XOR, NOT, and shift operations on two numbers, with binary, hex, and decimal views.
Values can be entered as decimal (12), hex (0x0C), binary (0b1100), or octal (0o14) — they're auto-detected by prefix.
—————All operations use signed 32-bit integers, matching JavaScript's native bitwise operators — the same behavior you'd see using &, |, ^, ~, <<, >>, and >>> directly in JS.
Frequently Asked Questions
What number formats can I type into Value A and Value B?
Decimal by default (12), or prefix with `0x` for hex (0x0C), `0b` for binary (0b1100), or `0o` for octal (0o14) — the format is auto-detected from the prefix before the operation runs.
Why does NOT A produce a negative number?
Because this tool uses signed 32-bit integers, exactly like JavaScript's native `~` operator — flipping every bit of a positive number very often produces a negative two's-complement result. The hex and binary views below still show the raw bit pattern if that's what you need.
What's the difference between >> and >>> for shifting?
`>>` is an arithmetic (sign-preserving) right shift — the sign bit is copied into the new high-order bits. `>>>` is a logical (zero-fill) right shift — it always fills the vacated high bits with zero, so negative numbers behave very differently between the two.
Does Value B do anything for the NOT operation?
No — NOT is a unary operation on Value A alone, so Value B is ignored when that button is active. It's used as the second operand for AND/OR/XOR and as the shift amount for the three shift operations.
Are these 32-bit or 64-bit operations?
32-bit, matching JavaScript's own bitwise operators exactly (which internally convert both operands to signed 32-bit integers before operating) — this is not an arbitrary-precision or 64-bit bitwise calculator.