Computer Science · Ch 2 — Encoding Schemes and Number System
Hexadecimal Number System
2.2.4
Hexadecimal Number System
Like octal, hexadecimal numbers are used for a compact representation of binary numbers — and they compress binary even further.
The base-16 system
- Hexadecimal consists of 16 unique symbols: the digits 0–9 and the letters A–F. It is called the base-16 system.
- The decimal values 10 through 15 are represented by the letters A through F:
A = 10 B = 11 C = 12 D = 13 E = 14 F = 15
- Examples of hexadecimal numbers: (23A.05)16, (1C3)16, (619B.A)16.
4 bits per hexadecimal digit
In the hexadecimal system, each alphanumeric digit corresponds to a group of 4 binary digits, because 4 bits are sufficient to represent 16 symbols:
2^4 = 16
So one hexadecimal symbol replaces four bits — a 16-bit binary string becomes just four hexadecimal characters.
The full symbol table
Decimal and binary equivalents of the 16 hexadecimal symbols:
| Hex symbol | Decimal value | 4-bit binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
Table 2.6Decimal and binary equivalent of hexadecimal numbers 0–9, A–F
| Hexadecimal Symbol | Decimal Value | 4-bit Binary Number |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |