Bitwise Calculator
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).
| Expression | Binary | Hex | Decimal | Signed |
|---|---|---|---|---|
| A | 0000 1100 | 0x0C | 12 | 12 |
| B | 0000 1010 | 0x0A | 10 | 10 |
| A & B | 0000 1000 | 0x08 | 8 | 8 |
| A | B | 0000 1110 | 0x0E | 14 | 14 |
| A ^ B | 0000 0110 | 0x06 | 6 | 6 |
| ~A | 1111 0011 | 0xF3 | 243 | -13 |
| ~B | 1111 0101 | 0xF5 | 245 | -11 |
| A << 1 | 0001 1000 | 0x18 | 24 | 24 |
| A >> 1 | 0000 0110 | 0x06 | 6 | 6 |
How to use
- Type two integers into A and B (decimal, or with a 0x / 0b / 0o prefix).
- Choose the bit width and a shift amount.
- 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
Two's Complement Converter (8–64 bit)
Enter a decimal, hex, binary, or octal value and see its 8/16/32/64-bit two's complement bit pattern, plus its signed and unsigned readings, hex, octal, and one's complement — in your browser.
ASCII Code Table
Browse and search the 256-row ASCII / extended-ASCII table — decimal, hex, octal, binary, and the named control characters.
Number Base Converter
Convert numbers between binary, octal, decimal, and hexadecimal.
Hex Dump Viewer
Inspect text or a small file as offset + hex bytes + printable ASCII, like `xxd` or `hexdump -C`.
Gray Code Converter
Convert between decimal, binary and reflected-binary Gray code, both directions, with an optional fixed bit width and a 0-7 reference table.
BCD Converter (Binary-Coded Decimal)
Convert decimal to and from 8421 binary-coded decimal — per-digit 4-bit nibbles, packed BCD hex bytes, and BCD validity checking.