Skip to content
Test versionSearch

Mathematics

Binary word operations

Operate on an explicitly chosen 8/16/32/64-bit word and inspect exact decimal/binary/hex values, bytes and bit positions.

How it worksFAQRelated tools

Content reviewed:

The example values can be changed. Press Calculate to update the result; you can download it as TXT or CSV and collect scenarios in this tab. JSON, HTML and TXT downloads keep your inputs and all result rows; long integers keep every digit you entered. Automatic recalculation after editing is off unless you switch it on. Nothing is saved, imported or sent automatically.

Integers up to 80 digits; spaces, underscores, apostrophes and signed 0b/0o/0x prefixes allowed. Inputs are masked modulo 2^N. Existing operations retain their prior decimal interpretation and wrap indicators. Logical right always zero-fills. Arithmetic right requires signed U2 mode, interprets the masked word as signed before shifting and propagates its sign; a negative result is not overflow. Its shift count is an integer from 0 to 1,000,000; at n >= N the result is -1 for negative words, otherwise 0. Existing left/logical-right counts remain 0..N. Byte order changes only the displayed bytes; bit indexes start at 0 and zero has no highest/lowest set bit.

Decimal results are approximate. Inputs stay in this browser tab.

Sources

How it works

Integers up to 80 digits; spaces, underscores, apostrophes and signed 0b/0o/0x prefixes allowed. Inputs are masked modulo 2^N. Existing operations retain their prior decimal interpretation and wrap indicators. Logical right always zero-fills. Arithmetic right requires signed U2 mode, interprets the masked word as signed before shifting and propagates its sign; a negative result is not overflow. Its shift count is an integer from 0 to 1,000,000; at n equal to or greater than N the result is -1 for negative words, otherwise 0. Existing left/logical-right counts remain 0..N. Byte order changes only the displayed bytes; bit indexes start at 0 and zero has no highest/lowest set bit. Separate unsigned full-product multiplication accepts two strings of 1 to 80 binary digits, retains entered leading zeros and returns the unpadded product up to 160 bits. It does not use word width, signed mode or modulo masking, or transfer values to the original form.

Worked example

With these example values the calculator gives the result below. You can change any value in the form above.

Inputs

Word operation
Convert A
Integer A
255
Base without a prefix
10
Word bits
8
Decimal interpretation
Unsigned
Byte display order
Big endian

Result

A decimal
255
A binary
11111111
A hexadecimal
FF
B decimal
Not used
B binary
Not used
B hexadecimal
Not used
Result
255
Binary
11111111
Hexadecimal
FF
Word minimum
0
Word maximum
255
A outside selected interpretation range
No

Frequently asked questions

Which word sizes do the binary word operations support?

You choose an 8, 16, 32 or 64-bit word and see exact decimal, binary and hex values, bytes and bit positions.

What happens to numbers that do not fit into the word?

Inputs are masked modulo 2^N, so the word value is the integer modulo 2^N for the chosen bit width.

What is the difference between logical and arithmetic right shift?

Logical right shift always fills with zeros. Arithmetic right shift requires signed two's complement mode and propagates the sign of the masked word.

Which number formats can I enter?

Integers up to 80 digits, with spaces, underscores, apostrophes and signed 0b, 0o or 0x prefixes allowed.

What is 255 as an 8-bit binary word?

255 in an unsigned 8-bit word is 11111111 in binary and FF in hexadecimal, with 8 set bits.

Can I multiply two binary numbers without overflow?

Yes, a separate form does full unsigned multiplication of two strings of 1 to 80 binary digits. The exact product can have up to 160 binary digits.