Bitwise Operations Calculator
Bitwise Logic Tool
Perform bitwise operations — AND, OR, XOR, NOT, shifts — on binary numbers. Visualize how each bit is processed, perfect for understanding low-level programming and digital logic design.
5Number Systems
∞Precision
0msLatency
Interactive Tool Module
Silicon Logic Gate Simulator
Inside a computer chip, physics dictates math. Tiny electrical switches called transistors combine to form "Logic Gates" (AND, OR, XOR). Toggle the inputs below to watch how pure electricity naturally forms logic!
Input A
Input B
Click to change
Gate Output
1
More
Other Number System Conversions
Related numeral systems converters for number conversion between binary, decimal, hexadecimal, octal, and ASCII text.
Binary to Decimal Converter Binary Fraction to Decimal Signed Binary to Decimal Binary to Hexadecimal Binary to Octal Binary Base Converter Binary Calculator Binary Addition Binary Subtraction Step-by-Step Solver Binary Table Generator Binary to Text Text to Binary Floating Point Converter Bit Size Converter Binary Decoder
FAQ
Frequently Asked Questions
What are bitwise operations?
Bitwise operations work on individual bits of binary numbers. The main operations are: AND (&) — both bits must be 1, OR (|) — at least one bit must be 1, XOR (^) — exactly one bit must be 1, NOT (~) — inverts all bits, Left Shift (<<) — shifts bits left (multiply by 2), Right Shift (>>) — shifts bits right (divide by 2).
How does bitwise AND work?
Bitwise AND compares each bit of two numbers: if both bits are 1, the result bit is 1; otherwise it's 0. Rules: 0&0=0, 0&1=0, 1&0=0, 1&1=1. Example: 1101 & 1010 = 1000₂. AND is commonly used for masking — extracting specific bits from a value by ANDing with a mask of 1s.
How does bitwise OR work?
Bitwise OR compares each bit: if at least one bit is 1, the result is 1; only if both are 0 is the result 0. Rules: 0|0=0, 0|1=1, 1|0=1, 1|1=1. Example: 1100 | 1010 = 1110₂. OR is commonly used for setting specific bits — turning bits on by ORing with a mask.
How does bitwise XOR work?
Bitwise XOR (exclusive OR) returns 1 when bits differ and 0 when they're the same. Rules: 0^0=0, 0^1=1, 1^0=1, 1^1=0. Example: 1100 ^ 1010 = 0110₂. XOR is special: A^A=0 (self-inverse), A^0=A (identity). It's used in encryption, error detection, swapping values without temp variables, and toggle operations.
What are bit shifts used for?
Left shift (<<) moves all bits left by n positions, filling with 0s on the right. This multiplies by 2ⁿ. Right shift (>>) moves bits right, effectively dividing by 2ⁿ. Shifts are used for fast multiplication/division by powers of 2, flag manipulation, color channel extraction, and protocol parsing.
Where are bitwise operations used in programming?
Bitwise operations are used in: flag management (permissions, feature toggles), graphics (color manipulation, pixel blending), networking (IP masks, protocol headers), cryptography (XOR ciphers), compression (bit packing), game development (collision masks), and embedded systems (hardware register control).
What is a bitmask?
A bitmask is a binary pattern used with bitwise operations to select, set, clear, or toggle specific bits. For example, to extract the lower 4 bits of a byte: value & 0x0F (AND with 00001111). To set bit 3: value | 0x08 (OR with 00001000). To toggle bit 5: value ^ 0x20 (XOR with 00100000).