Mathematical Tools
What It Does
Performs bit-level operations (AND, OR, XOR, NOT, NAND, NOR, XNOR, shifts, and rotates) on integers at 8/16/32/64-bit widths, signed or unsigned — and shows the result in binary, octal, decimal, and hex with a bit-by-bit grid. Everything runs in your browser.
How to Use It
- Choose the base your numbers are in, the register width, and signed/unsigned.
- Enter Operand A, pick an operation, and (for binary ops) Operand B — or a shift amount for shifts/rotates.
- Read the result in every base and inspect the bit grid.
- Click Copy on any row to grab it.
Options Explained
| Option | Description |
|---|---|
| Base | The base operands A and B are written in (2–36). |
| Operation | AND/OR/XOR/NOT/NAND/NOR/XNOR, shift left/right, rotate left/right. |
| Width | The register width (8/16/32/64) — results wrap/mask to this many bits. |
| Signed | Interpret values as two’s-complement; makes right shift arithmetic (sign-filling). |
| Shift amount | For shifts/rotates, how many bits to move (a whole, non-negative count). |
| Grouping | Groups output digits for readability. |
About Bitwise Operations — Masks, Flags & Shifts
Bitwise operations work on the individual 1s and 0s that make up a number, which is how low-level code packs many true/false “flags” into a single integer. AND is used to test or clear bits (anything AND 0 is 0), OR to set bits (anything OR 1 is 1), and XOR to toggle bits (a XOR 1 flips it). NOT flips every bit within the chosen width, which is why NOT 0x00 is 0xFF in 8 bits, not an infinitely long string of ones.
Shifting left by n multiplies by 2n (bits fall off the top and zeros fill the bottom), while shifting right divides by 2n — and here the signed setting matters: an arithmetic right shift copies the sign bit so negative numbers stay negative, whereas a logical shift fills with zeros. Rotations are like shifts except the bits that fall off one end wrap around to the other, so no information is lost. Because this tool masks every result to the selected width using arbitrary-precision integers, it mirrors exactly how an 8-, 16-, 32-, or 64-bit CPU register would behave — overflow and all — while running entirely on your device.