Bitwise Shift & Mask
Bitwise Shift & Mask applies AND, OR, XOR, NOT and shift operations (`<<`, `>>`, `>>>`) to two integers, showing the result in decimal, hex and 32-bit binary at once. It mirrors the exact 32-bit signed/unsigned behavior of JavaScript's own bitwise operators.
How it works
- 1Enter `a` (all operations except NOT also need `b`).
- 2Choose the operation: AND, OR, XOR, NOT, `<<`, `>>` or `>>>`.
- 3Read the result in decimal, hex and 32-bit binary.
- 4An invalid value (negative or fractional) shows a warning.
Frequently asked questions
What's the difference between `>>` and `>>>`?−+
`>>` is signed (arithmetic) shift, the top bit is preserved; `>>>` is unsigned (logical) shift, the top bit is always filled with 0. Since this tool only accepts unsigned values (0 to 2³²-1), they give the same result in most cases, differing only for large values where the top bit is set.
Why are values limited to 0-4294967295?−+
JavaScript's bitwise operators convert operands to 32-bit integers; this tool only accepts the unsigned 32-bit range (up to 2³²-1) to avoid signed/negative-input confusion.
Why does NOT only take one operand?−+
Bitwise NOT (`~a`) is unary by definition, it flips every bit; the `b` field is hidden when this operation is selected.
Why is the result sometimes bigger than I expected?−+
The result is always shown unsigned; e.g. `~0` is mathematically -1, but it's displayed here as 4294967295 (0xFFFFFFFF).
Is the data I enter stored anywhere?−+
No, the entire computation runs in your browser.
Embed on your site
<iframe src="https://toolsqube.com/en/software-engineering/bitwise-shift-mask/embed" width="480" height="360" style="border:0;border-radius:14px" title="Bitwise Shift & Mask · ToolsQube" loading="lazy"> </iframe>
Want to go deeper on this topic: Software Engineering Tools Guide →