Bitwise Calculator
Online bitwise calculator with AND, OR, XOR, NOT, shifts and multi-base inputs, featuring 8/16/32-bit visualization for debugging and bitmask design
Operand Inputs
Bit Width
Select Operation
Calculation Results
Binary Visualization
Bitwise Operations Guide
Bitwise operations act directly on binary digits and are useful for performance-sensitive logic, permissions, protocol parsing, and low-level data handling.
Common Bitwise Operations
AND (&)
Returns 1 only when both bits are 1. Commonly used for masking and bit checks.
OR (|)
Returns 1 when either bit is 1. Useful for setting specific flags.
XOR (^)
Returns 1 when bits are different. Useful for toggling bits and simple parity logic.
NOT (~)
Flips every bit. In JavaScript, bitwise operations use signed 32-bit integers.
Left Shift (<<)
Shifts bits left and fills the right side with 0. Often equals multiplying by powers of 2.
Right Shift (>>)
Shifts bits right and fills the left side with the sign bit. Often equals dividing by powers of 2.
Unsigned Right Shift (>>>)
Shifts bits right and always fills the left side with 0. Useful for unsigned integer workflows.
Base Conversion
Supports decimal, hex, binary, and octal input/output for fast debugging and comparison.
Operation Examples
| Expression | Description | Sample Result |
|---|---|---|
0b1100 & 0b1010 | AND operation | 0b1000 (8) |
0b1100 | 0b1010 | OR operation | 0b1110 (14) |
0b1100 ^ 0b1010 | XOR operation | 0b0110 (6) |
~0b1100 | NOT operation | ...11110011 (-13) |
0b1100 << 2 | Left shift by 2 | 0b110000 (48) |
0b1100 >> 2 | Right shift by 2 | 0b11 (3) |
-8 >>> 2 | Unsigned right shift by 2 | 1073741822 |
Typical Scenarios
Color Processing
Extract RGB channels and combine color values.
Permission Control
Represent, combine, and verify permissions with bitmasks.
Performance Tuning
Replace some multiply/divide operations with bit operations when appropriate.
Flag Management
Set, clear, and toggle flags efficiently.