Bitwise Calculator (AND, OR, XOR, NOT, Shift)

Compute AND, OR, XOR, NAND, NOR, XNOR, NOT, shifts and rotates on two 32-bit integers — result in decimal, hex, octal and binary, 100% in your browser.

Decimal 8
Hex 0x00000008
Octal 0o00000000010
Binary
0000 0000 0000 0000 0000 0000 0000 1000

Hex, octal and binary are shown as unsigned 32-bit values.

🔒 All bitwise math runs in your browser — nothing is uploaded.

What this bitwise calculator does

Enter two integers as decimal (like 255), hexadecimal (0xFF), octal (0o755) or binary (0b1010), pick an operation, and instantly see the result in decimal, hexadecimal, octal and 32-bit binary. It supports AND, OR, XOR, NAND, NOR, XNOR, NOT (unary on A), left shift (A << B), arithmetic right shift (A >> B), logical right shift (A >>> B), and rotate left and rotate right — the one bit operation JavaScript has no operator for. Every value is treated as a 32-bit integer using the same semantics as JavaScript, C and most systems languages.

Signed, unsigned and two's complement

The decimal output follows signed 32-bit rules, so operations like NOT 0 return -1 — and the unsigned reading, 4294967295, is printed beside it whenever the two differ. The hex, octal and binary outputs are shown as unsigned 32-bit patterns (via a zero-fill shift), which is why -1 appears as 0xFFFFFFFF, 0o37777777777 and all-ones binary. Arithmetic right shift copies the sign bit, while logical right shift fills with zeros — a common source of bugs, and easy to compare side by side here.

Frequently asked questions

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

A >> B is an arithmetic right shift that preserves the sign bit, so negative numbers stay negative. A >>> B is a logical right shift that fills the vacated high bits with zeros, always producing an unsigned result.

Can it rotate bits, or do NAND, NOR and XNOR?

Yes. Rotate left (ROL) and rotate right (ROR) carry the bits that fall off one end of the 32-bit word back in at the other, over the same fixed 32-bit width, for a count of 0 to 31. NAND, NOR and XNOR are in the same list, each the negation of its base gate, so ~(A & B) is one step rather than two.

Can I enter hexadecimal, octal or binary values?

Yes. Type values in decimal (for example 42), with a 0x prefix for hex (0x2A), a 0o prefix for octal (0o755 — the way file permissions are written) or a 0b prefix for binary (0b101010). You can also use a leading minus sign, such as -5 or -0x10.

Is anything uploaded to a server?

No. All parsing and bitwise math happens locally in your browser with JavaScript. Nothing you type is sent, stored or uploaded anywhere.