Calculator Inputs
Accepted input examples:
Decimal: 29, -5
Binary: 101101 or 0b101101
Octal: 35 or 0o35
Hexadecimal: 1D or 0x1D
Example Data Table
| Operation | A | B / Mask | Bit Width | Result | Binary Result |
|---|---|---|---|---|---|
| XOR | 29 | 15 | 8 | 18 | 00010010 |
| AND | 45 | 27 | 8 | 9 | 00001001 |
| NOT A | 12 | — | 8 | 243 | 11110011 |
| Set Bits in A | 34 | 12 | 8 | 46 | 00101110 |
| Rotate Left A | 19 | Shift 2 | 8 | 76 | 01001100 |
Formula Used
Bitwise operations compare integers one bit at a time. Every bit position independently returns a new bit. The calculator keeps all results inside the selected bit width.
- AND: Result = A & B
- OR: Result = A | B
- XOR: Result = A ^ B
- NOT: Result = ~A within the selected width
- Left Shift: Result = (A << n) masked to width
- Right Shift: Result = A >> n
- Set Bits: Result = A | Mask
- Clear Bits: Result = A & (~Mask)
- Toggle Bits: Result = A ^ Mask
- Test Mask: True when (A & Mask) = Mask
- Rotate Left: Result = ((A << n) | (A >> (w - n))) masked
- Rotate Right: Result = ((A >> n) | (A << (w - n))) masked
For negative decimal entries, the calculator first converts values into two’s complement form inside the chosen bit width.
How to Use This Calculator
- Enter Value A, Value B, and Mask Value.
- Choose the input base you want to use.
- Select a bit width between 1 and 32.
- Enter a shift amount when needed.
- Choose the required bitwise operation.
- Press Calculate to generate the result.
- Review the summary, bit table, and graph.
- Export the current result as CSV or PDF.
Frequently Asked Questions
1. What does a bitwise calculator do?
It evaluates integers at the bit level. Each binary digit is compared or transformed, producing results for logic operations, masks, inversions, shifts, and rotations.
2. Why does bit width matter?
Bit width decides how many bits remain visible. It changes NOT, shifts, masking, overflow behavior, and signed interpretation because all results stay inside that width.
3. What is the difference between XOR and OR?
OR returns 1 when either input bit is 1. XOR returns 1 only when the two input bits differ. Matching bits produce 0 in XOR.
4. When should I use a mask?
Use masks to isolate, set, clear, toggle, or verify specific bit positions. They are common in permissions, embedded flags, device registers, and packet fields.
5. Does the calculator support negative values?
Yes, for decimal input. Negative values are normalized into two’s complement form within the selected width, then displayed with unsigned and signed interpretations.
6. What is the difference between shift and rotate?
A shift moves bits and drops overflowed bits. A rotation moves bits around the edge, so shifted-out bits re-enter from the opposite side.
7. Why do I see different decimal and signed results?
The same stored bits can represent an unsigned value or a signed two’s complement value. The calculator shows both interpretations for clarity.
8. What do the CSV and PDF exports include?
They export the current result summary and bit breakdown. This makes reporting, debugging, documentation, and sharing calculation outputs much easier.