A bitwise calculator works on the 32-bit word the machine actually stores, not on the decimal you typed. The Bitwise Calculator takes two numbers, applies one of seven operations (AND, OR, XOR, NOT A, NOT B, left shift, right shift) and prints the result in five bases at once: decimal, hex, 8-bit binary, 32-bit binary and octal. Nothing is uploaded; the operations run on the JavaScript integers of the browser. This post walks each operation with worked numbers, shows where the sign bit sneaks into the shifts, and the masks that make AND the workhorse of byte-level code.
Seven Operations on One 32-bit Word
The three pairwise operations act on every bit position. 12 is 0b1100 and 10 is 0b1010: AND keeps only the positions where both have a 1, so 12 AND 10 = 0b1000 = 8; OR keeps a position where at least one has a 1, so 12 OR 10 = 0b1110 = 14; XOR keeps a position where exactly one has a 1, so 12 XOR 10 = 0b0110 = 6. The two NOT buttons flip every bit of one operand: 5 is 0b0101 and its flipped form 0b1010 is the two complement reading of -6, which in 32-bit hex prints as 0xFFFFFFFA. The two shifts move the bits: 1 left-shifted by 4 is 16, and 1024 right-shifted by 2 is 256. When you want the same value in another base without touching the bits, the number base converter does the pure conversion.
Three Input Bases, One 32-bit Value
Each field accepts plain decimal, hex with a 0x prefix and binary with a 0b prefix, and the parser keeps one 32-bit integer behind all three. 0xFF AND 0x0F = 15 is the low-nibble mask you meet in every byte protocol. While you type, the tool echoes each operand as a 32-bit binary string grouped in nibbles, and the result panel draws the low 8 bits as eight lit or unlit boxes: 255 lights all eight, 16 lights a single one. Reading those groups by eye is the same skill as turning text into binary codes, and the text to binary tool exercises it letter by letter.
Shifts, the Sign Bit and the 31 Mask
The right shift is arithmetic: it copies the sign bit as it moves, so -8 is 0xFFFFFFF8 and -8 right-shifted by 1 gives 0xFFFFFFFC = -4, not 0x7FFFFFFC. The left shift pads zeros from the right, but bit 31 is the sign bit of the 32-bit word, so 1 left-shifted by 30 is 1073741824 (0x40000000), still positive, while 1 left-shifted by 31 is -2147483648, the smallest negative number. The shift amount is masked to 0 through 31 first: 1 left-shifted by 33 behaves exactly like 1 left-shifted by 1 and returns 2. No error, no overflow note. Pulling a byte out of a word is the everyday pattern: 0xFF00 right-shifted by 8 gives 255. For byte-level round trips between hex and UTF-8, the hex UTF-8 Base64 converter is the sibling of this view.
Five Output Bases at Once
The result panel shows the same value five ways: decimal, hex (uppercase, 0x prefix), 8-bit binary, 32-bit binary and octal. 255 prints as 255, 0xFF, 0b1111 1111, the 32-bit string with its top 24 bits at zero, and 0o377. The octal column is not decoration: file permission triples are octal because each digit is exactly one group of 3 permission bits, so 0o755 is the 9-bit word 0b111101101, which is rwxr-xr-x and 493 in decimal. The chmod permission calculator expands that triple into the owner, group and other rows, which is this column at bit level.
Masks: the Everyday Job of AND
AND with a small number keeps only the low bits: 0xFF AND 0x0F = 15, and -1 AND 7 = 7 because -1 is all ones. Testing a single flag bit is value AND (1 << n): if the answer is not 0, bit n is set. XOR is its own inverse, so it is a one-line cipher: 65 XOR 42 = 107 and 107 XOR 42 = 65; a byte XORed twice with the same key comes back unchanged. 15 in the three compact bases is 0b1111, 0o17 and 0xF. The encodings that pack bytes into text, like Base64, sit on this same 6-bit grouping of the section, and the Base64 encoder and decoder shows the lookup table.
The Same 0 and 1 Everywhere
Bitwise math is the small layer under everything that counts in bytes. The text to binary guide cuts characters into 8-bit groups by hand; the hash generator then mixes a whole buffer with exactly these operations, AND, OR, XOR and rotations, until a 32-bit digest comes out. When the question is which base to read a value in, start from the bits: every base on this site, from the 8-bit boxes here to the octal digits of permissions, is the same 32-bit word in different notation. The calculator is where that word stops being abstract: two inputs, one operation, five ways to read the answer.