Hexadecimal
Hexadecimal (base 16) writes the values 0-15 as single digits: 0-9, then a-f. Can you spot the relationship between binary (base 2), octal (base 8) and hexadecimal (base 16)?
| Binary | Octal | Decimal | Hexadecimal | Base64 |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | A |
| 1 | 1 | 1 | 1 | B |
| 10 | 2 | 2 | 2 | C |
| 11 | 3 | 3 | 3 | D |
| 100 | 4 | 4 | 4 | E |
| 101 | 5 | 5 | 5 | F |
| 110 | 6 | 6 | 6 | G |
| 111 | 7 | 7 | 7 | H |
| 1000 | 10 | 8 | 8 | I |
| 1001 | 11 | 9 | 9 | J |
| 1010 | 12 | 10 | A | K |
| 1011 | 13 | 11 | B | L |
| 1100 | 14 | 12 | C | M |
| 1101 | 15 | 13 | D | N |
| 1110 | 16 | 14 | E | O |
| 1111 | 17 | 15 | F | P |
| 10000 | 20 | 16 | 10 | Q |
| 10001 | 21 | 17 | 11 | R |
| 10010 | 22 | 18 | 12 | S |
| 10011 | 23 | 19 | 13 | T |
| 10100 | 24 | 20 | 14 | U |
| 10101 | 25 | 21 | 15 | V |
| 10110 | 26 | 22 | 16 | W |
| 10111 | 27 | 23 | 17 | X |
| 11000 | 30 | 24 | 18 | Y |
| 11001 | 31 | 25 | 19 | Z |
| 11010 | 32 | 26 | 1A | a |
| 11011 | 33 | 27 | 1B | b |
| 11100 | 34 | 28 | 1C | c |
| 11101 | 35 | 29 | 1D | d |
| 11110 | 36 | 30 | 1E | e |
| 11111 | 37 | 31 | 1F | f |
| 100000 | 40 | 32 | 20 | g |
| … | … | … | … | … |
One hexadecimal digit is 4 bits, so 2 digits = 8 bits = 1 byte. That makes hex convenient for looking at raw memory and addresses. You’ve probably seen it in hexdumps. Here’s a hexdump of the first 256 bytes of this site’s favicon.ico (a WEBP in disguise):
00000000: 5249 4646 e603 0000 5745 4250 5650 384c RIFF....WEBPVP8L
00000010: d903 0000 2f17 c005 1035 c9cd b66d 9514 ..../....5...m..
00000020: 3b3e 6e6b e38b bbbb bb13 4903 9aba 3b64 ;>nk......I...;d
00000030: 50c5 9291 6944 e47e e697 7366 a6a1 b516 P...iD.~..sf....
00000040: fe90 026c 8a40 23ba d036 b8c8 c9dc b36d ...l.@#..6.....m
00000050: 002d 6773 3252 3bd9 5a46 037a aad8 1ac8 .-gs2R;.ZF.z....
00000060: 2842 27c3 a229 614a d874 236a d026 f622 (B'..)aJ.t#j.&."
00000070: dd22 b856 aa98 0492 6dbb 6d9b 0f8b 944f .".V....m.m....O
00000080: 7aef 7d56 a7d9 ff34 1be9 c576 e443 fc43 z.}V...4...v.C.C
00000090: 1380 20d9 b6db b601 a40f 0120 e9a6 92e2 .. ........ ....
000000a0: 3eca fe47 d943 7690 7d34 c945 50ff 2780 >..G.Cv.}4.EP.'.
000000b0: 640f 6c01 ab59 14f7 39fc 641f 95e4 1658 d.l..Y..9.d....X
000000c0: 6c61 609d 9045 0102 1560 b244 06d6 880e la`..E...`.D....
000000d0: 5135 47b0 8da2 85f5 96bc b7cb fa99 aa05 Q5G.............
000000e0: 0592 2a74 4065 a0fa c8b7 6c72 00db 0dda ..*t@e....lr....
000000f0: 3323 cff5 1e7f ec77 bf9e d3a7 9f81 2d80 3#.....w......-.Readable ASCII runs from 0x20 (space) to 0x7E (~); 0x7F is DEL, a control character.