The positional notation principle
In base b, each digit is a coefficient multiplied by a power of b. Decimal 347 means 3×10² + 4×10¹ + 7, and the same rule defines binary, octal and hexadecimal notation.
Changing the base does not change the mathematical value, only its representation. 0xFF, 255 and 11111111₂ can therefore denote the same integer.
Binary, octal and hexadecimal
Binary uses two digits and maps naturally to bit states. Octal groups bits in threes, while hexadecimal groups them in fours and uses A-F for values ten through fifteen.
Hexadecimal is compact for bytes, addresses, masks and dumps because one byte is exactly two hex digits. Octal remains useful in specific Unix conventions such as permission notation.
Converting without changing meaning
To convert from a base to decimal, sum each digit's positional contribution. To convert a non-negative decimal integer to another base, repeated division or powers can be used depending on whether the calculation is manual or implemented.
Binary and hexadecimal convert directly by grouping four bits. Leading zeroes do not change an integer's value, but they may be significant when a representation has fixed width.
Sign and two's complement
A minus sign is a mathematical notation, while a fixed-width bit pattern may be interpreted as unsigned or signed. Modern systems overwhelmingly use two's complement for signed integers.
The bit pattern 11111111 is 255 as an unsigned 8-bit value and -1 as signed two's complement. Width and interpretation are therefore required to map a bit pattern to a signed number.
Overflow and fixed width
An n-bit integer can represent only a finite range. Hardware operations often retain the lowest n bits, producing unsigned wrap-around or language-specific behavior for signed overflow.
Registers, protocols and binary files require knowledge of width, signedness and endianness. The base used to print the number does not determine any of these properties.
Practical uses and best practices
Binary is useful for masks and flags; hexadecimal makes bytes and addresses readable; octal serves specific conventions; decimal remains natural for human-facing quantities.
Use unambiguous prefixes or labels, preserve meaningful leading zeroes where width matters and keep the numerical value separate from the semantic interpretation of the field.