Bitwise Calculator
Perform bitwise operations (AND, OR, XOR, NOT, shift left, shift right) on two integers. Useful for low-level programming and digital logic design.
Was this calculator helpful?
How to use this tool?
This calculator performs bitwise operations on two integers. Follow these steps:
- Enter the first integer in the "First Integer" field (e.g., 12).
- Enter the second integer in the "Second Integer" field (e.g., 5). This field is disabled when "NOT" is selected.
- Choose an operation from the dropdown:
- AND, OR, XOR — standard bitwise operations on both numbers.
- NOT — inverts the bits of the first integer only.
- Left Shift / Right Shift — shifts the first integer by the second integer’s value.
- Click "Calculate" or press Enter in any input field.
- The result shows:
- The integer result (e.g.,
4). - The binary representation (e.g.,
100). - A detail line showing the operation (e.g.,
12 & 5 = 4).
- The integer result (e.g.,
All inputs must be integers. The "NOT" operation disables the second input automatically.
Previous Results
| Result | Inputs | Date |
|---|
Frequently Asked Questions
A bitwise operation operates on one or more bit patterns or binary numerals at the level of their individual bits. Common operations include AND, OR, XOR, NOT, and bit shifts.
The NOT operation flips all bits of the number. In JavaScript, ~x returns -(x+1) because of two's complement representation. For example, ~5 = -6.
Yes, the calculator accepts negative integers. Bitwise operations treat numbers as signed 32-bit integers in JavaScript.