Compute AND, OR, XOR, NOT and bit shifts on two integers.
Calculated locally in your browser.
How do you calculate bitwise operations on two integers?
AND keeps bits set in both numbers, OR keeps bits set in either, XOR keeps bits set in exactly one, NOT inverts all bits, and shifts move bits left or right. Operations use 32-bit integers, matching JavaScript and many languages. For example, 12 AND 10 = 8, 12 OR 10 = 14, and 12 XOR 10 = 6.
Understanding your result
Operations use 32-bit integers, matching how JavaScript and many languages handle bitwise maths.
Formula and method
AND keeps bits set in both, OR keeps bits set in either, XOR keeps bits set in exactly one, NOT inverts all bits, and shifts move bits left or right.
Worked example
12 AND 10 = 8, 12 OR 10 = 14, 12 XOR 10 = 6.
How to use this tool
- Enter integer A (and optionally B).
- Read the result of each operation.
Common mistakes to avoid
- Expecting unsigned results for NOT — ~12 is −13 in signed 32-bit.
About the Bitwise Calculator
Perform bitwise operations on two integers and see the result in decimal, binary and hexadecimal.
Who should use this tool
Programmers working with flags, masks and low-level logic.
Frequently asked questions
What is the difference between >> and >>>?
>> keeps the sign bit (arithmetic shift); >>> fills with zeros (logical shift).
What bit width is used?
32-bit signed integers, as in JavaScript.