A little context. A clearer answer.
When this calculator is useful
AND keeps only bits set in both operands, while OR also keeps a bit set in just one of them. Change “Operation” from AND to OR and keep the other inputs from the worked example. The value for “Hexadecimal” goes from 0xC0 to 0xFC. For a related calculation, try Big number calculator with exact decimals.
What to enter
| Input | What it means | Example value |
|---|---|---|
| Input base | Input base: Hexadecimal / Binary / Decimal. | Hexadecimal |
| Word width | Word width: 8 bit / 16 bit / 32 bit / 64 bit / 128 bit. | 8 bit |
| Unsigned / Signed two’s complement | Unsigned / Signed two’s complement: Unsigned / Signed two’s complement. | Unsigned |
| Word A | A: HEX F0; BIN 11110000; DEC 240. ≤160. | F0 |
| Operation | Operation: AND / OR / XOR / NOT / Left shift / Logical right shift / Arithmetic right shift. | AND |
| Word B | B: HEX CC; BIN 11001100; DEC 204. ≤160. | CC |
| Shift distance | Shift distance: 0 … 128. | — |
How the calculation works
- Compare fixed-width integer words in hexadecimal, binary and decimal. Click individual bits and see how masks, signed interpretation and shifts change the result.
- Input base: Hexadecimal / Binary / Decimal. Word width: 8 bit / 16 bit / 32 bit / 64 bit / 128 bit. Unsigned / Signed two’s complement: Unsigned / Signed two’s complement. A: HEX F0; BIN 11110000; DEC 240. ≤160. Operation: AND / OR / XOR / NOT / Left shift / Logical right shift / Arithmetic right shift. B: HEX CC; BIN 11001100; DEC 204. ≤160. Shift distance: 0 … 128.
- Read the result and compare it with the diagram.
m = 2ʷ−1; u = n & m; s = u ≥ 2ʷ⁻¹ ? u−2ʷ : uA worked example
Bitwise calculator: AND, OR, XOR and shifts: 8 bit: 0xF0 AND 0xCC = 0xC0; XOR = 0x3C; NOT 0x00 = 0xFF.
Example you can load
What to enterThis is a fixed example; changing the form above does not change these numbers.
Assumptions & limits
Choose 8, 16, 32, 64 or 128 bits. Inputs outside the range are masked and flagged. Signed decimal input uses two’s complement; HEX and BIN may describe the full bit pattern. Arithmetic right shift extends the top bit, even when the output is displayed unsigned. Shifts are limited to 0–128.
Frequently asked questions
How is the result calculated?
Compare fixed-width integer words in hexadecimal, binary and decimal. Click individual bits and see how masks, signed interpretation and shifts change the result. m = 2ʷ−1; u = n & m; s = u ≥ 2ʷ⁻¹ ? u−2ʷ : u
How should I enter the values?
Bitwise calculator: AND, OR, XOR and shifts: 8 bit: 0xF0 AND 0xCC = 0xC0; XOR = 0x3C; NOT 0x00 = 0xFF.
What are the limits?
Choose 8, 16, 32, 64 or 128 bits. Inputs outside the range are masked and flagged. Signed decimal input uses two’s complement; HEX and BIN may describe the full bit pattern. Arithmetic right shift extends the top bit, even when the output is displayed unsigned. Shifts are limited to 0–128.