← All tools
// Number

Bitwise Calculator online

AND, OR, XOR, NAND, NOR, XNOR, NOT, shifts and bit rotation — browser-only

Bitwise Calculator logo
by
CHUNKY
MUNSTER

How to Use bitwise-calculator

  1. Enter two integer values (in decimal, hex with 0x prefix, or binary with 0b).
  2. Select the operation: AND, OR, XOR, NOT, left shift, or right shift.
  3. The result appears in decimal, hex, and binary with the bit patterns shown side by side.
  4. Use the bit visualiser to see which bits are set in each operand and the result.

Bitwise operations work directly on the binary representation of integers — each bit is tested or modified independently. They are fundamental to systems programming, network masking, permission flags, graphics programming, and compression algorithms. This calculator shows the complete bit-level breakdown so you can see exactly how each operation changes individual bits.

Bitwise Operations Reference

AND (&) — a bit is 1 only if both inputs have 1 in that position. Used for masking: value & 0xFF extracts the low byte. OR (|) — a bit is 1 if either input has 1. Used for setting flags. XOR (^) — a bit is 1 if the inputs differ. Used for toggling bits and simple encryption. NOT (~) — flips all bits. Left shift (<<) — multiplies by powers of 2. Right shift (>>) — divides by powers of 2.

Frequently Asked Questions

How does bitwise AND work for masking?

0xFF in binary is 11111111. ANDing any value with 0xFF zeros out all bits above the low 8, extracting just the least significant byte. This is the basis of all bitmask operations.

What is the difference between >> and >>>?

>> is an arithmetic right shift — it preserves the sign bit, shifting in 1s for negative numbers. >>> is a logical (unsigned) right shift — it always shifts in 0s, treating the value as unsigned.

Why does ~ on a positive integer give a negative result?

JavaScript stores integers as 32-bit signed two's complement values. ~0 flips all 32 bits of 0 (all zeros) to all ones — which is -1 in two's complement signed representation.

How are file permissions like chmod 755 related to bitwise?

Unix permissions are three 3-bit fields: owner, group, other. 7 = 0b111 (rwx), 5 = 0b101 (r-x). Each bit represents a permission flag — read (bit 2), write (bit 1), execute (bit 0).

See also the Binary to Decimal converter and Hex to Binary tool for number-base work.