Bitwise Calculator

Do bitwise math at a fixed width and see the result in every base. Enter numbers in decimal, hex, binary or octal, pick AND, OR, XOR, NAND, NOR, NOT or a shift, choose 8, 16, 32 or 64 bits, and get the answer in binary, hex, unsigned and signed form. Click individual bits to flip them. 64-bit values stay exact. It's free and runs entirely in your browser.

Truth table

ABANDORXOR
00000
01011
10011
11110

When to use it

  1. Work out flag and permission bitmasks.
  2. Check register values while writing embedded or driver code.
  3. Understand two's-complement results of signed shifts.
  4. Verify 64-bit hash or ID manipulations that JavaScript would truncate.

How to Use

  1. Enter operand A (and B for two-operand operations).
  2. Choose the operation and bit width.
  3. Read the results in binary, hex and decimal.
  4. Click bits of A to flip them.

Features

  1. AND, OR, XOR, NAND, NOR, NOT
  2. Left, arithmetic and logical right shifts
  3. 8, 16, 32 and 64-bit
  4. Decimal, hex, binary and octal input
  5. Signed and unsigned output
  6. Clickable bits
  7. 100% client-side

FAQs

Why does NOT 0 give 255?

At 8 bits, inverting 00000000 gives 11111111, which is 255 unsigned or −1 signed. Both are shown.

What's the difference between >> and >>>?

Arithmetic >> keeps the sign bit, so negative numbers stay negative. Logical >>> shifts in zeros.

Can it handle 64-bit numbers?

Yes, exactly. It uses BigInt; ordinary JavaScript bitwise operators only work on 32 bits.

How do I enter hex or binary?

Use 0x for hex, 0b for binary and 0o for octal, or plain digits for decimal.

Is anything uploaded?

No. The calculation runs in your browser.

Technical Details

Bitwise results depend on the width of the integer, so every operation here is performed at an explicit 8, 16, 32 or 64 bits. Operands can be typed in decimal, hexadecimal (0x), binary (0b) or octal (0o), including negative numbers, which are taken in two's complement. Arithmetic is done with JavaScript BigInt, so 64-bit values are exact — JavaScript's own bitwise operators silently convert to 32-bit integers and lose the upper half. Each result is masked to the chosen width: NOT 0 at 8 bits is 255, and a left shift drops the bits that fall off the top. Right shift comes in two forms: arithmetic (>>), which copies the sign bit down so negative numbers stay negative, and logical (>>>), which fills with zeros. NAND and NOR are included for logic-design work. Results are shown in grouped binary, hexadecimal and both unsigned and signed decimal, and the bits of the first operand can be flipped by clicking.

Developer Tools

Developer Tools

  • MIME Type Lookup
  • Luhn Validator
  • IBAN, ISBN & Barcode Validator
  • SSL Certificate Decoder
  • HAR File Viewer
  • OpenAPI & Swagger Viewer
  • Log Analyzer
  • .env File Validator