The idea in plain English: You know how we normally count in base-10 (0-9)? Computers count in base-2 (0-1, binary). But binary numbers get very long very fast — the number 255 in binary is 11111111 (eight digits!). Hexadecimal (hex for short) is base-16: it uses 0-9 plus A-F as digits, where A=10, B=11, C=12, D=13, E=14, F=15. One hex digit represents exactly 4 bits, and two hex digits represent one byte (8 bits). It's a compact way to show binary data.
Why this really exists: Hex is everywhere in programming. Web colors like
#FF5733 are hex (FF=red, 57=green, 33=blue). Memory addresses in debuggers and error
messages are shown as hex. When you look at raw binary data (a hex dump), it's displayed as hex.
Even this webpage uses hex color codes in its CSS.
The hex string "48656C6C6F" decodes to the word "Hello":
The hex digits come in pairs because each pair = one byte = one ASCII character. Just split the string into pairs, convert each pair to decimal, then to a character.
1. Split the hex string into pairs of characters: 48 65 6C 6C 6F
2. Convert each pair from base-16 to decimal: 48 = 4×16 + 8 = 72
3. Convert the decimal number to an ASCII character: 72 = 'H'
4. Join all characters → the decoded message!
💡 Unlike Base64, hex doesn't use padding — every pair of characters is exactly one byte. If the hex string has an odd length, there's likely a typo.
| Hex | Decimal | Binary | ASCII (if printable) |
|---|---|---|---|
| 00 | 0 | 00000000 | NUL (null) |
| 20 | 32 | 00100000 | Space |
| 30 | 48 | 00110000 | '0' |
| 41 | 65 | 01000001 | 'A' |
| 61 | 97 | 01100001 | 'a' |
| 7A | 122 | 01111010 | 'z' |
| FF | 255 | 11111111 | (not printable) |