About Bitwise Calculator – AND, OR, XOR, Shifts
A bitwise calculator applies low-level operations — AND, OR, XOR, NOT, and bit shifts — directly to the binary representation of integers. These operations are the foundation of permission flags, bitmasks, color packing, network masks, and countless performance-sensitive tricks, but reasoning about them in your head is error-prone. Seeing the bits line up makes the effect obvious.
This bitwise calculator shows operand A, operand B, and the result as aligned, fixed-width binary rows, so you can watch exactly which bits flip. Set bits are highlighted, and the rows are grouped into nibbles for fast reading. Inputs accept decimal, hexadecimal (0x), or binary (0b), and every value is computed with BigInt — so even numbers well beyond the 53-bit JavaScript safe range stay exact.
Everything runs locally in your browser. No values are uploaded, logged, or sent anywhere, so it is safe to use with sensitive flags or keys while completely offline.
Features
- AND, OR, XOR, NOT, and left/right shift operations
- Aligned bit-grid: A, B, and result as fixed-width binary rows with set bits highlighted
- Decimal, hexadecimal (0x), and binary (0b) input — exact for large values via BigInt
- Result shown in decimal, hex, and binary with one-click copy; fully offline
How to use
- Enter integer A (and B) as decimal, 0x hex, or 0b binary.
- Pick an operation — AND, OR, XOR, NOT, or a shift — and a bit width.
- Read the aligned bit grid to see which bits changed.
- Copy the result as decimal, hex, or binary.
Frequently asked questions
How does NOT (bitwise complement) work here?
NOT flips every bit within the selected bit width. Because an unbounded complement of a positive integer is negative, the result is masked to the chosen width (8, 16, 32, or 64 bits), giving a clean non-negative value — exactly like a fixed-size integer would in C or Rust.
What is the difference between a left shift and a right shift?
A left shift (a << b) moves every bit b places toward the high end, effectively multiplying by 2^b. A right shift (a >> b) moves bits toward the low end, dividing by 2^b and discarding the bits that fall off the right.
Why use BigInt instead of regular numbers?
JavaScript's normal bitwise operators coerce values to 32-bit signed integers, which silently corrupts anything larger. This tool uses BigInt so 64-bit masks and values far beyond 2^53 are computed exactly.
Does my input get sent anywhere?
No. All parsing and bit math happen locally in your browser. Nothing you type leaves your device, so the tool works fully offline.
Related tools
Everything runs locally in your browser — your input is never uploaded.