Compute bitwise math with clear inputs and results. Switch bases, widths, masks, and shift modes. Practice logic faster with exports, examples, and formula guidance.
Select an operation and submit the form to view the exact formula.
General mask rule: normalized value = input mod 2n for positive values, and two’s complement wrapping for negative values within n bits.
Signed interpretation rule: if the top bit is 1, signed value = unsigned value - 2n.
| Value A | Value B | Operation | Bit Width | Result |
|---|---|---|---|---|
| 29 | 15 | AND | 8 | 13 |
| 29 | 15 | XOR | 8 | 18 |
| 29 | 2 | Left Shift | 8 | 116 |
| 29 | 3 | Toggle Bit | 8 | 21 |
Bitwise functions are compact and powerful. They work at the bit level. This calculator helps you inspect each operation clearly. You can test logic, masks, shifts, and rotations in one place.
AND keeps bits that match at one. OR keeps any bit set. XOR highlights difference. NOT flips each bit inside the chosen width. Those rules matter in mathematics, programming, and digital design.
Width controls the visible bit range. A width of eight keeps eight bits. A width of sixteen keeps sixteen bits. The calculator applies a mask after each step. This keeps the answer inside the selected range.
Signed interpretation adds more insight. The same bits can mean different decimal values. Unsigned mode reads the raw magnitude. Signed mode reads the top bit as a sign bit. That is useful for two’s complement analysis.
Shifts move bits left or right. A left shift multiplies by powers of two before masking. A logical right shift drops low bits and adds zeros. Rotations wrap lost bits around the other side. That helps with hash functions and low level algorithms.
Bit setting tools are also included. You can set, clear, toggle, or test one bit position. This is useful for flags, permissions, compact storage, and state tracking. It is also common in parsers and protocol work.
The calculator accepts decimal, binary, octal, and hexadecimal input. It normalizes values to the chosen width. Then it reports unsigned decimal, signed decimal, binary, octal, and hexadecimal output. That saves time during debugging and study.
Students can compare manual work against instant results. Developers can verify masks before writing production code. Engineers can inspect control bits and packed values. Teachers can use the example rows during lessons. The layout stays simple and practical.
This page also helps reduce common input mistakes. You can switch bases without changing your workflow. You can view grouped binary strings for easier reading. That improves accuracy during homework, interview practice, and low level troubleshooting.
Use the result table for fast comparison. Export the output as CSV for records. Export the table as PDF for reports or class notes. The example table below shows common cases. The formula section explains how each answer is produced.
AND keeps only shared 1 bits. OR keeps any 1 bit. XOR marks different bits. NOT flips bits inside the selected width.
Bit width defines how many bits stay visible. The calculator masks results to that width. This changes NOT, shifts, rotations, and signed interpretation.
Yes. Negative decimal input is converted into the selected width using two’s complement behavior. The result table then shows both unsigned and signed interpretations.
A regular right shift inserts zeros on the left because the calculator uses the normalized unsigned value. This makes the output predictable across chosen widths.
Rotation wraps shifted bits around the opposite side. A shift discards moved bits. Rotations are useful in hashing, cryptography study, and compact bit tricks.
Use binary for direct bit inspection. Use octal or hexadecimal for shorter grouped notation. Use decimal when you want signed or unsigned numeric meaning.
Set changes one bit to 1. Clear changes one bit to 0. Toggle flips one bit. Test returns whether a chosen bit is on.
CSV is useful for spreadsheets and logs. PDF is useful for printing, sharing, reports, and storing calculation snapshots with the visible result table.
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.