Bitwise Calculator
Perform bitwise operations on binary numbers - AND, OR, XOR, NOT, left shift, right shift, and more.
Bitwise Operations
Shift Operations
Operation Result
Bit-by-bit Operation
| Bit Position | A | B | Operation | Result |
|---|---|---|---|---|
| Enter binary numbers and select an operation | ||||
Bitwise Operations Guide
What are Bitwise Operations?
Bitwise operations work directly on the binary representations of numbers, manipulating individual bits. Unlike logical operations, bitwise operations work on each bit position independently. These are fundamental to low-level programming, digital electronics, cryptography, and graphics programming.
Bitwise AND (&) Operation
Returns 1 only if both input bits are 1. Otherwise returns 0. Useful for masking and extracting specific bits.
| A | B | A & B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Example: 101101 & 110011 = 100001
Bitwise OR (|) Operation
Returns 1 if at least one input bit is 1. Returns 0 only if both bits are 0. Used for setting bits and combining flags.
| A | B | A | B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Example: 101101 | 110011 = 111111
Bitwise XOR (^) Operation
Returns 1 if input bits are different, 0 if they are the same. Used in cryptography and error detection.
| A | B | A ^ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Example: 101101 ^ 110011 = 011110
Bitwise NOT (~) Operation
Flips each bit: 0 becomes 1, and 1 becomes 0. This is a unary operation working on one operand.
Example: ~101101 = 010010 (in 6-bit representation)
Shift Operations (<< and >>)
Left Shift (<<): Moves bits left, filling with 0s on the right. Multiplies by 2 for each shift.
Right Shift (>>): Moves bits right. Divides by 2 for each shift (truncated).
Example: 101101 << 2 = 10110100 (multiply by 4)