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).
| 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
Base64 to Hex Converter (and back)
Convert a Base64 string to hexadecimal bytes and hex back to Base64, with URL-safe support, in your browser.
Quoted-Printable Encoder & Decoder
Encode text to MIME Quoted-Printable (RFC 2045) or decode it back — handling =XX escapes, soft line breaks, and UTF-8 — entirely in your browser, with 76-character line wrapping on encode.
Hash Generator (SHA)
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hashes from text.
URL Encoder / Decoder
Percent-encode text for URLs, or decode encoded URLs back to text.
Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to text, instantly.
JSON Formatter & Validator
Format, beautify, minify, and validate JSON right in your browser.