Work with signed, unsigned, masked, and shifted integers. See binary patterns before coding complex expressions. Test logic quickly with clear outputs and instant charts.
| Operation | Expression | Description |
|---|---|---|
| AND | A & B |
Returns 1 only where both bits are 1. |
| OR | A | B |
Returns 1 where either input bit is 1. |
| XOR | A ^ B |
Returns 1 only where the bits are different. |
| NOT | ~A |
Flips every bit in A within the chosen width. |
| Left Shift | A << n |
Moves bits left by n positions. Vacated right bits become 0. |
| Right Shift | A >> n |
Moves bits right by n positions. Signed mode shows arithmetic shifting. |
| Masking | A & Mask |
Keeps only the bit positions enabled by the mask. |
| Set or Merge Mask | A | Mask |
Turns on the bit positions provided by the mask. |
| Width Constraint | mask = (1 << bits) - 1 |
Limits every result to the selected fixed-width representation. |
| Signed Interpretation | signed = unsigned - 2^bits |
Applied only when the highest bit is set in signed mode. |
| Input Base | Bit Width | Mode | Operand A | Operand B | Mask | Shift | A & B | A | B | A ^ B | ~A | A << 1 | A >> 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Decimal | 8-bit | Unsigned | 12 | 5 | 3 | 1 | 4 | 13 | 9 | 243 | 24 | 6 |
| Binary | 8-bit | Unsigned | 1100 | 0101 | 0011 | 1 | 00000100 | 00001101 | 00001001 | 11110011 | 00011000 | 00000110 |
| Hexadecimal | 16-bit | Signed | 0x00F0 | 0x000F | 0x00FF | 2 | 0 | 255 | 255 | -241 | 960 | 60 |
It evaluates common C bitwise operations using fixed-width integers. You can inspect AND, OR, XOR, NOT, shifts, and mask-based operations in decimal, binary, octal, and hexadecimal views.
Bit width controls overflow, truncation, and sign interpretation. The same value can produce different NOT, shift, and masking results when evaluated as 8-bit, 16-bit, or 32-bit data.
Signed mode interprets the highest bit as the sign bit using two’s complement. It changes the displayed decimal value and makes right shift behave like arithmetic shift in this calculator.
In unsigned mode, NOT flips every bit and keeps the result inside the chosen width. For example, ~12 becomes 243 in 8-bit mode because only eight bits are retained.
Yes. Choose the correct input base first, then enter values normally. Prefixes like 0b, 0o, and 0x are also accepted for binary, octal, and hexadecimal inputs.
A custom mask helps isolate, clear, or enable selected bit positions. Use A & Mask to keep chosen bits, or A | Mask to force selected bits on.
Shifts larger than the active width are not stable for fixed-width demonstrations. This page limits the shift amount to width minus one so the results stay readable and consistent.
They export the current input summary and calculated result table. This makes it easier to share test cases, keep debugging notes, or attach examples to documentation.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.