Mathematical Tools

Active tool: Bitwise Calculator

Selected option: Results update automatically

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

  1. Choose the base your numbers are in, the register width, and signed/unsigned.
  2. Enter Operand A, pick an operation, and (for binary ops) Operand B — or a shift amount for shifts/rotates.
  3. Read the result in every base and inspect the bit grid.
  4. Click Copy on any row to grab it.

Options Explained

OptionDescription
BaseThe base operands A and B are written in (2–36).
OperationAND/OR/XOR/NOT/NAND/NOR/XNOR, shift left/right, rotate left/right.
WidthThe register width (8/16/32/64) — results wrap/mask to this many bits.
SignedInterpret values as two’s-complement; makes right shift arithmetic (sign-filling).
Shift amountFor shifts/rotates, how many bits to move (a whole, non-negative count).
GroupingGroups output digits for readability.
💡 Tip: Use AND with a mask to clear bits, OR to set them, and XOR to toggle them. Rotate keeps every bit, while shift discards bits that fall off the end.
Input

Enter Operand A to see the result in every base.

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.