Skip to content
D DocNectar

Free Bitwise Calculator

Perform AND, OR, XOR, NOT, NAND, or NOR on binary numbers — one consolidated calculator for every basic bitwise operation.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

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.

  1. Enter first binary number.
  2. Enter operation.
  3. Enter second binary number (not needed for NOT).
  4. 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.

Frequently asked questions

AND, OR, XOR, NOT, NAND, and NOR all operate on the same binary inputs with the same bit-width considerations, differing only in which per-position logical rule is applied — a single operation selector avoids building six nearly identical tools that would otherwise duplicate almost all of their functionality.
XOR is its own inverse: applying it twice with the same value returns the original input (a XOR b XOR b = a), which makes it uniquely useful for simple encryption schemes, swapping two variables without a temporary variable, and detecting exactly which bits changed between two values.
NAND is simply "AND, then flip the result" — but it has a special significance in digital electronics because any other logic gate (AND, OR, NOT, XOR, and so on) can be built entirely out of NAND gates alone, making it a "universal gate" that real computer chips are often physically constructed from.
Flipping every bit only makes sense once you've fixed how many bit positions exist — flipping "101" (3 bits) gives "010", but the same value considered as 8 bits ("00000101") flips to "11111010", an entirely different resulting number, since the flip now applies to all the additional leading zero bits too.
ANDing a number with a mask that has a 1 only in the position you care about isolates just that bit (checking it), ORing with a mask that has a 1 in that position forces that bit on (setting it), and XORing with such a mask toggles that bit's current state — three of the most common patterns in low-level flag and permission handling.
They're related but distinct — logical AND/OR (often written && and || in code) operate on entire true/false values and typically short-circuit, while bitwise AND/OR (& and |) operate independently on every individual bit of a number's binary representation, which can produce very different results when applied to multi-bit numbers.

Get new calculators and guides in your inbox

No spam — just new tools like Bitwise Calculator and practical guides.

Favorites