Unlock the power of bitwise operations with our free online Bitwise Operator Calculator. Easily perform AND, OR, XOR, NOT, Left Shift, Right Shift, and Unsigned Right Shift on decimal or binary numbers. Ideal for understanding data manipulation, flag management, and low-level programming concepts in languages like C, Java, Python, and JavaScript.
Formula:
The Bitwise Operator Calculator performs operations directly on the binary representations of numbers. Understanding how bits are manipulated is crucial in many programming contexts, from embedded systems to network protocols.
The key bitwise operations available are:
- AND (
&): For each bit position, the result bit is 1 if both corresponding bits of the operands are 1. Otherwise, it's 0. - OR (
|): For each bit position, the result bit is 1 if at least one of the corresponding bits of the operands is 1. Otherwise, it's 0. - XOR (
^): For each bit position, the result bit is 1 if the corresponding bits of the operands are different. Otherwise, it's 0. This is often used for toggling bits or encryption. - NOT (
~): (Unary) Inverts all bits of an operand. A 0 becomes 1, and a 1 becomes 0. In JavaScript, this operates on 32-bit signed integers, often resulting in a negative number for positive inputs. - Left Shift (
<<): Shifts all bits of the first operand to the left by a specified number of positions (second operand). New bits introduced on the right are 0. Equivalent to multiplying by powers of 2. - Signed Right Shift (
>>): Shifts all bits of the first operand to the right by a specified number of positions (second operand). The new bits introduced on the left preserve the sign bit (arithmetic shift). - Unsigned Right Shift (
>>>): Shifts all bits of the first operand to the right by a specified number of positions (second operand). New bits introduced on the left are always 0, regardless of the sign bit (logical shift).