Binary, Hexadecimal, Octal, and ASCII: The Essential Developer Guide to Number Systems
At the most fundamental hardware level, every piece of software—from operating system kernels and web browsers to 3D game engines—is executed as electrical voltage transitions representing 0s and 1s.
Understanding how numbers and text are represented across Binary (Base-2), Octal (Base-8), Decimal (Base-10), and Hexadecimal (Base-16) is essential for systems programming, cryptography, network protocols, and frontend performance debugging.
1. The Core Number Bases Explained
Every number system relies on a radix (base), which dictates how many unique digits represent values before carrying over to the next positional column:
| System | Base | Digits Used | Example Value | Decimal Equivalent |
|---|---|---|---|---|
| Binary | 2 | 0, 1 | 1101 0101 | 213 |
| Octal | 8 | 0-7 | 325 | 213 |
| Decimal | 10 | 0-9 | 213 | 213 |
| Hexadecimal | 16 | 0-9, A-F | D5 | 213 |
2. Why Hexadecimal is the Industry Standard for Computers
While computers think in binary bits, reading a stream of raw binary (such as 11001010111111101011101010111110) is exhausting for human engineers.
Because $16 = 2^4$, exactly 4 binary bits (a nibble) map to 1 single hexadecimal character:
1100=C1010=A1111=F1110=E
Therefore, one byte (8 bits) can always be written as a clean 2-character hex pair (from 00 to FF). This is why memory addresses (0x7FFF5FBFF8B0), CSS color codes (#3B82F6), and UUID strings are formatted in Hexadecimal.
3. How Text Encoding Works: ASCII vs. Unicode UTF-8
Computers don't store letters—they store numbers mapped to character glyphs using encoding tables:
ASCII (American Standard Code for Information Interchange)
- 7-bit standard mapping numbers
0through127to standard English characters and control signals. - For example:
- Letter 'A' = Decimal
65= Hex0x41= Binary01000001 - Letter 'a' = Decimal
97= Hex0x61= Binary01100001(notice only the 6th bit changes for case!) - Space ' ' = Decimal
32= Hex0x20= Binary00100000
- Letter 'A' = Decimal
Unicode UTF-8
- Variable-width encoding using 1 to 4 bytes per character, supporting every human language, math symbols, and modern emojis (e.g., 🚀 is encoded as 4 bytes:
0xF0 0x9F 0x9A 0x80).
4. Bitwise Operators Cheat-Sheet
In high-performance applications (such as graphics processing and permission bitmasks), bitwise operations run in a single CPU clock cycle:
- AND (
&):1 & 1 = 1, all other combinations0. (Used for bitmask filtering). - OR (
|):0 | 0 = 0, all other combinations1. (Used for combining permission flags). - XOR (
^): Returns1only if bits differ. (Core primitive in encryption ciphers). - Bit Shift Left (
<<): Multiplies an integer by powers of 2. (5 << 1 = 10). - Bit Shift Right (
>>): Divides an integer by powers of 2. (20 >> 2 = 5).
Convert Between Binary, Hex, Decimal, and Text Instantly
Need to convert strings to binary arrays, translate hex bytes to ASCII text, or test bitwise operations? Try our interactive Binary & Base Translator tool!