Bitwise Calculator
Perform bitwise operations and see the binary results instantly.
About the Bitwise Calculator
We built this Bitwise Calculator to be a simple and educational tool for developers, computer science students, and anyone curious about how computers work with data at the lowest level. It allows you to perform standard bitwise logical operations (like AND, OR, XOR) and bit shifts on integers. The key feature is the live binary breakdown, which shows you exactly how the bits of your numbers are being manipulated to produce the result, making these abstract concepts easy to visualize and understand.
How to Use the Tool
- Enter your numbers into the "Operand A" and "Operand B" input fields. The binary representations below will update as you type.
- Click on any of the operation buttons (e.g., AND, OR, Left Shift).
- The decimal result will appear instantly, and the "Binary Breakdown" will show you the full calculation, bit by bit.
- Use the "Copy" buttons to grab the decimal result or the full binary breakdown for your notes.
Frequently Asked Questions
What are bitwise operations?
Bitwise operations are actions that work on numbers at the level of their individual bits (the 1s and 0s they're made of). Instead of performing math on the decimal value of a number, they compare and manipulate the binary digits. They are extremely fast and are often used in low-level programming, graphics, and for managing multiple true/false flags within a single number.
What is the difference between AND, OR, and XOR?
These are the three basic logical operations:
- AND (&): Compares two bits and returns `1` only if both bits are `1`. (e.g., `1 & 1 = 1`, but `1 & 0 = 0`).
- OR (|): Compares two bits and returns `1` if either of the bits is `1`. (e.g., `1 | 0 = 1`).
- XOR (^): (Exclusive OR) Compares two bits and returns `1` if the bits are different. (e.g., `1 ^ 0 = 1`, but `1 ^ 1 = 0`).
What does the NOT (~) operator do?
The Bitwise NOT operator inverts all the bits of a single number. It flips every `1` to a `0` and every `0` to a `1`. In 32-bit systems, this leads to a result known as the "two's complement," which is why `~5` results in `-6`, not a large positive number.
What's the difference between Right Shift `>>` and `>>>`?
Both operators shift the bits of a number to the right. The key difference is how they handle negative numbers:
- Right Shift (`>>`): This is a "sign-propagating" shift. If the number is negative (its leftmost bit is `1`), it will fill the empty spaces on the left with `1`s to preserve the negative sign.
- Zero-fill Right Shift (`>>>`): This is a "non-sign-propagating" shift. It *always* fills the empty spaces on the left with `0`s, regardless of whether the number was positive or negative.
Is the data I enter private?
Yes. All calculations are performed entirely in your web browser using JavaScript. None of the numbers you enter are ever sent to our servers. Your work remains completely private.