AZ Tools

Bitwise Calculator

Developer

Enter two integers and see every common bitwise operation at once: AND, OR, XOR, NOT (~A and ~B) and left/right shifts by any amount. Each result is shown in binary (grouped into nibbles), hexadecimal, unsigned decimal and two's-complement signed decimal. Pick an 8, 16, 32 or 64-bit width and results wrap to that size, so NOT and shifts behave exactly like they would in C, Rust or a register. Inputs accept decimal, 0x hex, 0b binary and 0o octal, and negatives are interpreted as two's complement. Computed with arbitrary-precision integers, so 64-bit values stay exact. Great for embedded work, bit flags and masks, protocol decoding and learning how binary operations work.

Accepts decimal, 0x hex, 0b binary, 0o octal (negatives allowed).

ExpressionBinaryHexDecimalSigned
A0000 11000x0C1212
B0000 10100x0A1010
A & B0000 10000x0888
A | B0000 11100x0E1414
A ^ B0000 01100x0666
~A1111 00110xF3243-13
~B1111 01010xF5245-11
A << 10001 10000x182424
A >> 10000 01100x0666

How to use

  1. Type two integers into A and B (decimal, or with a 0x / 0b / 0o prefix).
  2. Choose the bit width and a shift amount.
  3. Read each operation across binary, hex, unsigned and signed columns.

Frequently asked questions

How are negative numbers handled?
They're interpreted as two's complement at the chosen width — for example −1 becomes all ones (0xFF at 8-bit). The signed column shows the two's-complement value of every result.
What does the bit width change?
It masks results to that many bits, which matters for NOT and shifts. ~12 is 0xF3 at 8-bit but 0xFFFFFFF3 at 32-bit, just like a fixed-size integer in C or a CPU register.
Can I enter hex or binary?
Yes — use a 0x prefix for hex (0xFF), 0b for binary (0b1010) or 0o for octal. Plain decimal works too.
Are 64-bit results exact?
Yes. The calculator uses arbitrary-precision integers internally, so 64-bit operations don't lose precision the way 32-bit JavaScript bit operators would.

Related tools