Built and fact-checked by the DocNectar team — see our editorial standards
Key Features
Instant Calculation
Get accurate results in real time with our optimized algorithm.
Mobile Friendly
Fully responsive design. Works on all devices & screen sizes.
Privacy Focused
Your data stays on your device. We don't store any inputs.
100% Free
No hidden costs. This tool is completely free forever.
Bitwise operations compare or transform two binary numbers one bit position at a time, applying a simple logical rule (like "both must be 1" for AND, or "exactly one must be 1" for XOR) independently at every position — the foundation of digital logic gates, CPU arithmetic circuits, and countless everyday programming tricks. Unlike ordinary arithmetic, which treats a binary number as a single combined value, bitwise operations treat it as a row of independent 0/1 switches, each compared or flipped on its own. Bitwise logic underlies a huge range of practical low-level programming: setting, clearing, or checking individual flag bits in a status register or permissions field (using AND/OR/XOR masks), fast multiplication or division by powers of 2 via bit shifting, image processing and graphics blending using XOR and AND masks, cryptographic algorithms that lean heavily on XOR for its reversible, "self-canceling" property, and network programming, where subnet masks are computed with bitwise AND between an IP address and a mask.
How it works
Enter one or two binary numbers and choose an operation. AND, OR, XOR, NAND, and NOR each compare the two numbers' corresponding bit positions independently, one at a time: AND outputs 1 only when both bits are 1; OR outputs 1 when at least one bit is 1; XOR ("exclusive or") outputs 1 only when the two bits differ; NAND and NOR are simply AND and OR with the result flipped afterward. NOT operates on just a single number, flipping every one of its bits (0 becomes 1, and 1 becomes 0) — and because flipping bits only makes sense relative to a fixed number of bit positions, NOT (and by extension NAND/NOR, which incorporate a NOT step) depends on how many bits are considered part of the number.
- Enter first binary number.
- Enter operation.
- Enter second binary number (not needed for NOT).
- Click Calculate to see your results.
Examples
5 AND 3
101 AND 011 = 001 = 1 — only the rightmost bit position has a 1 in both numbers.
5 XOR 3
101 XOR 011 = 110 = 6 — the leftmost and middle positions differ between the two numbers (so they become 1), while the rightmost position matches (1 and 1, so it becomes 0).
NOT 5 (using 3 bits)
NOT 101 = 010 = 2 — every bit is flipped, but only across the 3 bit positions being considered; extending to more bits (like 0101 → 1010, which is 10) would give a completely different numeric result.
Common mistakes to avoid
- Forgetting that NOT (and therefore NAND/NOR) depends on how many bits are considered — flipping "101" gives "010" only if exactly 3 bits are in scope, and a different result if more bits are assumed.
- Confusing bitwise operators with logical (boolean) operators in programming — & and | act per-bit, while && and || act on whole true/false values and short-circuit.
- Assuming XOR behaves like OR — XOR specifically excludes the case where both bits are 1, unlike OR, which includes it.
- Misaligning the bit positions of two numbers with different lengths before comparing them, instead of padding the shorter one with leading zeros first.