Bitwise Calculator

Perform bitwise operations: AND, OR, XOR, NOT, NAND, NOR.

Input format:

Bitwise Truth Table

ABANDORXORNANDNOR
0000011
0101110
1001110
1111000

Code Examples

const a = 0b1010;  // 10
const b = 0b1100;  // 12
a & b;  // AND:  0b1000 (8)
a | b;  // OR:   0b1110 (14)
a ^ b;  // XOR:  0b0110 (6)
~a;     // NOT:  -11 (inverts all bits)

Frequently Asked Questions

What are bitwise operations used for?

Bitwise operations are used for: setting/clearing flags, permission systems, graphics programming, cryptography, network protocols, and optimized arithmetic.

What's the difference between AND and OR?

AND (&) returns 1 only when both bits are 1. OR (|) returns 1 when either bit is 1. AND is used to check/clear bits, OR is used to set bits.

What is XOR used for?

XOR (^) returns 1 when bits differ. Common uses: toggling bits, swapping values without temp variable, simple encryption, checksum calculations.

Related Tools