Programmer Calculator

Use this calculator

A programmer calculator interprets integers as finite binary words and performs bitwise logic. Binary, octal, decimal and hexadecimal show the same stored bits in different notations; signed and unsigned decimal interpretations depend on word size.

Mathematical foundation

1010_2=10_{10}=\mathrm A_{16}
w = selected word size in bits (8, 16, 32 or 64); M = bit mask containing w ones; x = unsigned stored word; the signed formula applies when its leading bit is set (two’s complement).

Mathematical foundation

w = selected word size in bits (8, 16, 32 or 64); M = bit mask containing w ones; x = unsigned stored word; the signed formula applies when its leading bit is set (two’s complement).

Mathematical foundation

Set base, width and the integer

Control / modeUnit or choiceMeaning / validation
Number baseHEX / DEC / OCT / BINFour selectors change how the current value is displayed; DEC is the initial selection.
Word size8 bit / 16 bit / 32 bit / 64 bit32-bit initial size, changes unsigned truncation and signed interpretation.
Value in base ntextPrimary value parsed in selected base; valid word enables representations and operations.
Second operand / shift amounttextSecond value for AND/OR/XOR; decimal shift count for SHL/SHR.
OperationsAND, OR, XOR, NOT, SHL, SHRMasked/truncated bitwise operations; share and save-image actions become available after a valid calculation.

Perform masked bitwise operations

Select the number base, enter a valid primary integer and choose word size. Enter a second integer for AND, OR or XOR; enter a decimal shift amount from 0 to 1024 for SHL or SHR. NOT uses the first value alone. The operation updates the primary value and its displayed representations.

Representations, history and image actions

The representations show HEX, DEC unsigned, DEC signed at selected word width, OCT and BIN. Calculation history captures valid operations; Share image and Save image are enabled after a valid result. Parsing uses BigInt; operations mask their results to the current word width.

A worked AND/XOR comparison

At 8 bits, A = 1010₂ and B = 1100₂: AND yields 1000₂, XOR yields 0110₂. A labelled bit grid shows why the selected bits differ.

A word is a finite row of bits. The selected word size masks the integer after bitwise operations.

At 8 bits, A = 1010₂ and B = 1100₂: AND yields 1000₂, XOR yields 0110₂. A labelled bit grid shows why the selected bits differ.

Two’s-complement interpretation

At 8 bits, 11111111₂ is 255 unsigned or −1 signed. The underlying eight bits are unchanged; only the interpretation differs.

Bit-by-bit logic example. AND keeps shared 1 bits; XOR keeps differing bits.

At 8 bits, 11111111₂ is 255 unsigned or −1 signed. The underlying eight bits are unchanged; only the interpretation differs.

Shift and overflow behaviour

Left shift drops bits outside the selected word, while right shift in the calculator operates on an unsigned-normalized value. Use the mask diagram to understand why shifting 8-bit 10000000₂ left once yields 00000000₂.

Signed and unsigned interpretations. The same eight bits represent two different decimal readings.

Left shift drops bits outside the selected word, while right shift in the calculator operates on an unsigned-normalized value. Use the mask diagram to understand why shifting 8-bit 10000000₂ left once yields 00000000₂.

Quick answers

What is the default word size?

32 bits.

Are signed and unsigned DEC both displayed?

Yes. The representations show both interpretations for the selected width.

What shift amounts are accepted?

A whole number from 0 to 1024; bitwise results are masked to the selected width.

Can I save a calculation image?

Yes, after a valid operation result, Share image and Save image are enabled.