Programmer Calculator
Online programmer calculator for base conversion
Programmer
How this calculator works
Word size (QWORD / DWORD / WORD / BYTE)
Every value is masked to the selected width: 64, 32, 16, or 8 bits. Arithmetic, bitwise ops, shifts, and memory all use this mask. In the bit grid, indices above the active width are disabled (read-only) so you always see which bits belong to the current word.
Bases (HEX / DEC / OCT / BIN)
Tap a row to choose the keypad input radix. Only valid digits for that base are accepted. All four readouts show the same underlying value. The DEC line uses two's-complement signed integers for the current word size; HEX, OCT, and BIN lines show unsigned grouped forms. Binary panels trim leading all-zero nibbles on the MSB side for readability, while keeping lower bits through bit 0 when needed.
Arithmetic
Use +, −, ×, ÷, and %. Operations apply to masked unsigned values in the current word. For QWORD, multiplication wraps modulo 264; narrower words wrap modulo 2n. Division or remainder by zero leaves the left-hand value unchanged (no error state).
Bitwise operators
AND, OR, XOR combine two operands with &, |, ^, then mask. NAND is ~(a & b); NOR is ~(a | b), both masked. NOT is a unary one's complement (invert every bit in the word). The ± key performs two's-complement negation (signed negate), which is different from NOT.
Examples below use decimal operands and assume BYTE (8-bit) word size so results fit in one byte; the same rules apply after masking for wider words.
- AND — bits must both be 1.
12 AND 10:0000 1100∧0000 1010→0000 1000= 8. - OR — at least one 1.
12 OR 10→0000 1110= 14. - XOR — 1 where bits differ.
12 XOR 10→0000 0110= 6. - NAND — NOT of AND, then mask.
12 AND 10 = 8;~8in 8 bits →1111 0111= 247 (0xF7). - NOR — NOT of OR, then mask.
12 OR 10 = 14;~14in 8 bits →1111 0001= 241 (0xF1). - NOT (one's complement) — flip every bit of the current value.
NOT 5:~0000 0101→1111 1010= 250 (0xFA). - ± (two's-complement negate) — not a bitwise op, shown for contrast. With BYTE,
5becomes signed −5 (DEC shows −5); as unsigned 8-bit that is 251 (0xFB), not 250, so NOT and ± differ.
Shifts (<< / >>)
Each press shifts by exactly one bit. Choose the mode from the toolbar: Logical shift — left fills 0 at LSB side of the shift; right fills 0 at MSB. Arithmetic shift — left matches logical for one step; right replicates the sign bit in two's complement (signed right shift). Rotate — MSB wraps to LSB on left; LSB wraps to MSB on right. Rotate through carry — one extra carry bit participates (RCL/RCR style): on left, the old carry enters LSB and the old MSB becomes carry; on right, the old carry enters MSB and the old LSB becomes carry. Carry resets when you change mode, clear (C), or change word size.
Expression line, memory, and bit grid
The small line above the main display shows the ongoing formula (operators as AND, OR, …) using the same radix style as the main readout for operands. MS stores the current value; M▾ offers MR (recall), MC (clear memory), and M+ (add to memory), all masked. In Bit toggling mode, clicking a bit XORs that position; the value updates immediately.
Keyboard
When focus is inside the calculator card, you can type digits and operators; < / > for shifts, ~ for NOT, Enter or = for equals, Backspace, Delete or C (except in HEX where C is a digit), Esc to close menus or clear. K / I switch Keypad vs Bit toggling. Modifiers Ctrl/Cmd/Alt are left to the browser.
All processing runs locally in your browser; nothing is sent to a server.