Bitwise Calculator — AND, OR, XOR, NOT, NAND, NOR & Bit Shifts

Compute AND, OR, XOR, NOT, NAND, NOR & XNOR on two numbers with a live bit-level visualization. Enter values in decimal, hex, binary, or octal — get the result in all four instantly.

  • 7 Bitwise Operators
  • Left/Right Shift
  • Bit Visualization
  • Dec/Hex/Bin/Oct
  • 100% Private
Value A
Value B
Shift by
Result
A AND B
8
DEC8
HEX0x8
BIN1000
OCT10
All operations use 32-bit signed integer semantics, matching JavaScript, C, and most languages.

A Complete Bitwise Toolkit

Every operator you need for flags, masks, and low-level logic — in one place.

  • 7 Operators

    AND, OR, XOR, NOT, NAND, NOR, and XNOR — every core bitwise operation in one tool.

  • Bit Shifts

    Left shift and right shift with a configurable shift amount.

  • Bit Visualization

    See every bit of A, B, and the result highlighted at 8, 16, or 32-bit width.

  • 4 Number Formats

    Enter and read values in decimal, hexadecimal, binary, or octal.

Get a Bitwise Result in Seconds

  1. 1

    Choose an Operator

    Pick AND, OR, XOR, NOT, NAND, NOR, XNOR, or a shift from the tabs.

  2. 2

    Enter Values

    Type Value A (and B, if needed) in decimal, hex, binary, or octal.

  3. 3

    Read the Result

    See the answer instantly in all four formats, plus a bit-level breakdown.

Frequently Asked Questions

An AND calculator performs a bitwise AND between two numbers: each output bit is 1 only if both corresponding input bits are 1. It's commonly used to check or clear specific bits (bitmasking), such as testing permission flags.

An OR calculator performs a bitwise OR: each output bit is 1 if either corresponding input bit is 1. It's typically used to set specific bits — for example, combining multiple flags into a single value.

An XOR (exclusive OR) calculator outputs 1 only when the two corresponding input bits differ. XOR is widely used for toggling bits, simple checksums, parity calculation, and basic data encryption/obfuscation, since XOR-ing twice with the same key returns the original value.

A NOT calculator inverts every bit of a single number — every 0 becomes 1 and every 1 becomes 0 (bitwise complement). Because most systems use two's complement for signed integers, the NOT of a number N is equal to -(N+1).

NAND is the inverse of AND (output is 1 unless both bits are 1), and NOR is the inverse of OR (output is 1 only if both bits are 0). Both are "universal gates" in digital logic — any other bitwise or logic operation can be built from NAND alone, or from NOR alone.

Yes. Switch either input's format selector to Binary, Octal, or Hexadecimal, and type your value in that format. The result is always shown in all four formats simultaneously so you don't need to convert manually.

A left shift (<<) moves all bits left by N positions, filling with zeros — equivalent to multiplying by 2^N. A right shift (>>) moves bits right by N positions — equivalent to integer division by 2^N for non-negative numbers.

This tool operates on standard 32-bit signed integers by default, matching how bitwise operators behave in JavaScript, C, and most other languages. Use the bit-width selector to switch between 8, 16, and 32-bit views to match your use case.

What Are Bitwise Operators?

Bitwise operators work directly on the individual binary digits (bits) of a number, rather than treating the number as a whole. They're foundational in low-level programming, embedded systems, graphics, cryptography, and anywhere permission flags or compact data encoding are used — file permissions (chmod), RGBA color channels, network protocol headers, and feature flags all lean on bitwise logic.

Truth Table Reference

ABANDORXORNANDNORXNOR
00000111
01011100
10011100
11110001

Why Use an AND Calculator for Bitmasking?

ANDing a value against a mask isolates specific bits — for example, value & 0xFF extracts just the lowest 8 bits of a number. This is the basis of reading individual flags out of a packed integer, such as checking if the "read" permission bit is set in a Unix file mode.

Why Use an OR Calculator to Set Flags?

ORing a value with a bit pattern sets those bits without disturbing any others — flags | 0b0100 turns on the third bit regardless of what the rest of flags currently holds. Combining several individual flag constants with OR is the standard way many APIs let you pass multiple options in a single integer argument.

XOR: Toggling Bits and Simple Encryption

XOR has a unique property: applying the same XOR operation twice returns the original value ((A XOR B) XOR B = A). This makes XOR useful for toggling specific bits on and off, swapping two variables without a temporary variable, computing simple checksums, and implementing basic stream-cipher-style obfuscation.

Left Shift & Right Shift

A left shift (<<) multiplies a number by a power of two by moving every bit left and filling the vacated positions with zero. A right shift (>>) divides by a power of two the same way, moving bits right. Shifts are commonly faster than equivalent multiplication or division and are used heavily in performance-sensitive and embedded code.