Binary, Octal, Decimal, and Hexadecimal Explained
Every number system works the same way — the only difference is how many digits it uses before carrying to the next place. Decimal uses 10 digits (0–9), binary uses 2 (0–1), octal uses 8 (0–7), and hexadecimal uses 16 (0–9 plus A–F). Once you see the pattern, converting between them is straightforward.
Binary (base 2) is the foundation of all computing. Every processor instruction, every byte of memory, and every network packet is ultimately a sequence of 0s and 1s. The binary number 1101 means 1×8 + 1×4 + 0×2 + 1×1 = 13 in decimal.
Hexadecimal (base 16) is shorthand for binary. Each hex digit maps to exactly 4 bits, making it compact and easy to read. The byte 11111111 in binary is FF in hex — two characters instead of eight.
Octal (base 8) maps each digit to 3 bits. It was common in early computing (PDP-8, Unix) and still appears in Unix file permissions today.
Binary-to-Hex Quick Reference
| Hex | Binary | Decimal | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| A | 1010 | 10 | 12 |
| B | 1011 | 11 | 13 |
| C | 1100 | 12 | 14 |
| D | 1101 | 13 | 15 |
| E | 1110 | 14 | 16 |
| F | 1111 | 15 | 17 |
ASCII Characters and Their Hex/Binary Values
Every character you type has a numeric code. The letter “A” is 65 in decimal, 41 in hex, 01000001 in binary. Lowercase “a” is 97 decimal, 61 hex. The space character is 32 decimal, 20 hex. Knowing these mappings helps when debugging network protocols, reading hex dumps, or working with character encodings.
| Char | Decimal | Hex | Binary |
|---|---|---|---|
| Space | 32 | 20 | 00100000 |
| 0 | 48 | 30 | 00110000 |
| 9 | 57 | 39 | 00111001 |
| A | 65 | 41 | 01000001 |
| Z | 90 | 5A | 01011010 |
| a | 97 | 61 | 01100001 |
| z | 122 | 7A | 01111010 |
CSS Hex Color Codes Are Base-16 Math
When you write #FF5733 in CSS, you are writing three hexadecimal numbers: FF for red (255), 57 for green (87), and 33 for blue (51). Each pair ranges from 00 (0 decimal, no intensity) to FF (255 decimal, full intensity). The shorthand #F00 expands to #FF0000 — pure red.
Understanding hex means you can read and tweak colors without a color picker. Need a slightly darker blue? #0000CC (204 decimal) is darker than #0000FF (255 decimal). Need 50% opacity? Add 80 at the end (128 in decimal, half of 256).
| Color | Hex | R, G, B (decimal) | Binary (R channel) |
|---|---|---|---|
| Red | #FF0000 | 255, 0, 0 | 11111111 |
| Green | #00FF00 | 0, 255, 0 | 00000000 |
| Blue | #0000FF | 0, 0, 255 | 00000000 |
| White | #FFFFFF | 255, 255, 255 | 11111111 |
| Black | #000000 | 0, 0, 0 | 00000000 |
| SplitGenius Navy | #1E3A5F | 30, 58, 95 | 00011110 |
| SplitGenius Teal | #0C9B8A | 12, 155, 138 | 00001100 |
Unix File Permissions Use Octal
When you run chmod 755 script.sh, those three digits are octal numbers. Each digit represents 3 bits: read (4), write (2), execute (1). The digit 7 = 4+2+1 = rwx (all permissions). The digit 5 = 4+0+1 = r-x (read and execute, no write). So 755 means the owner gets full control, while the group and others can read and run but not modify.
| Octal | Binary | Permission | Meaning |
|---|---|---|---|
| 0 | 000 | --- | No permissions |
| 1 | 001 | --x | Execute only |
| 4 | 100 | r-- | Read only |
| 5 | 101 | r-x | Read + execute |
| 6 | 110 | rw- | Read + write |
| 7 | 111 | rwx | Full (read + write + execute) |
Common permission patterns: 644 (owner reads/writes, everyone else reads — typical for files), 755 (owner full, others read/execute — typical for directories and scripts), 600 (owner only — SSH keys and secrets), and 777 (everyone does everything — almost never what you want).
For percentage-based math and proportion problems, the percentage calculator handles all three common modes. For fraction simplification and mixed numbers, the fraction calculator converts between forms instantly.