Bitwise Calculator
Calculate AND, OR, XOR, NOT and left, arithmetic right and logical right shifts on 8, 16, 32 or 64-bit integers, with results in binary, hex, unsigned and signed.
Free · No sign-up · Your inputs stay in your browser
Input
Bitwise calculator: AND, OR, XOR, NOT and shifts
Output
a & b
| Binary | Hex | Unsigned / signed | |
|---|---|---|---|
| a | 1011 0110 | 0xB6 | 182 / -74 |
| b | 0000 1111 | 0x0F | 15 / 15 |
| result | 0000 0110 | 0x06 | 6 / 6 |
Values are truncated to the chosen width, the way a fixed-size integer behaves in C, Go, Rust or a database column. Unsigned and two's-complement signed readings of the same bits are both shown. The arithmetic shift copies the sign bit in from the left; the logical shift fills with zeros. AND with a mask tests bits, OR sets them, XOR toggles them.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
What each operation is for
AND with a mask tests or clears bits (flags & 0x04), OR sets them, XOR toggles them and is its own inverse, NOT flips every bit within the width. Shifts multiply or divide by powers of two; the arithmetic right shift keeps the sign of negative numbers, the logical one fills with zeros. Permission bits, feature flags, network masks and hash functions all use them.
Width changes the answer
~5 is 250 as an 8-bit unsigned value and 4294967290 as a 32-bit one. JavaScript's bitwise operators work on 32-bit signed integers, which is why 1 << 31 is negative there; BigInt operators have no width limit.