How to use it
- Type the first value in First value (A), and the second in Second value (B) when the operation uses it.
- Choose the Number system the values are typed in, and the Operation.
- For a shift or rotation, set Shift or rotate by. Choose the Width the result should have.
- Read the result in Hexadecimal, Decimal (unsigned) and Binary, and the bit-by-bit table below them.
The logic operations
0xCA AND 0x0F = 11001010 AND 00001111 = 00001010 = 0x0A
- AND gives 1 only where both bits are 1. Use it to keep some bits and clear the others.
- OR gives 1 where either bit is 1. Use it to set bits.
- XOR gives 1 where exactly one bit is 1. Applying the same XOR twice returns the original value.
- NAND and NOR are AND and OR followed by NOT. NOT flips every bit inside the width.
Shifts and rotations
A left shift moves every bit up one place and fills the bottom with zeros; a bit that leaves the top is lost. A logical right shift moves every bit down and fills the top with zeros. An arithmetic right shift fills the top with copies of the sign bit, so a negative value stays negative. A rotation moves a bit that leaves one end back in at the other end.
0xCA shifted left by 1 = 10010100 (0x94); logical right = 01100101 (0x65); arithmetic right = 11100101 (0xE5); rotate left = 10010101 (0x95)
The width matters
NOT of zero is 0xFF in 8 bits, 0xFFFF in 16 bits and 0xFFFFFFFF in 32 bits, because the result has as many bits as the width. A value that needs more bits than the width is not stored in full: the tool uses its lowest bits and shows the Check line in red.
What the tool does not cover
- Languages differ. JavaScript's bitwise operators convert their operands to 32-bit integers, so they cannot show 64-bit results. This tool shows the bits of the width you choose, with BigInt so that 64-bit values are exact.
- Bit fields inside a structure, byte order and file formats: for those, see the hex viewer.
Worked example: 0xCA AND 0x0F in 8 bits
Type CA as the first value and 0F as the second, with the Number system set to hexadecimal and the Width set to 8 bits. The result is 00001010, which is 0x0A in hexadecimal and 10 in decimal. Only the bits that both values have set in the same place remain: two of them, both in the low four places that 0F keeps.
| Result | Value |
|---|---|
| Hexadecimal | 0x0A |
| Binary | 0b0000 1010 |
| Decimal (unsigned) | 10 |
Frequently asked questions
What is the difference between a logical and an arithmetic right shift?
Both move the bits down one place. A logical shift fills the top with zeros, so it treats the value as unsigned. An arithmetic shift copies the sign bit, so a negative value stays negative: 0xCA is −54, and shifted right by 1 it is −27 (0xE5).
Why does NOT give a different result at different widths?
NOT flips every bit the width has. Zero is 00000000 in 8 bits, so NOT gives 11111111 (0xFF); in 32 bits zero has 32 bits, so NOT gives 0xFFFFFFFF. The same number has a different number of bits in each width.
What does a rotation do that a shift does not?
A shift loses the bits that leave one end. A rotation puts them back at the other end, so no bit is lost. Rotating by the width gives the same value again.
Why is a value flagged when it does not fit the width?
A value that needs more bits than the width cannot be stored in full. The tool uses the lowest bits, so 300 in 8 bits becomes 44, and the Check line says what happened so the result is not taken as the value you typed.
Can I type binary numbers with spaces?
Yes. Spaces and underscores are ignored, so 1100 1010 and 11001010 are the same value. Hexadecimal may have a 0x prefix, and binary may have a 0b prefix.
Sources
Figures and text last checked on Tuesday, November 10, 2026.