Hexadecimal (Base 16) Number System
The hexadecimal number system (base 16, often called "hex") is the most widely used alternative number system in computing. It uses 16 symbols: digits 0–9 and letters A–F, where A=10, B=11, C=12, D=13, E=14, F=15.
Hexadecimal Digits
| Hex | Decimal | Hex | Decimal |
|---|---|---|---|
| 0 | 0 | 8 | 8 |
| 1 | 1 | 9 | 9 |
| 2 | 2 | A | 10 |
| 3 | 3 | B | 11 |
| 4 | 4 | C | 12 |
| 5 | 5 | D | 13 |
| 6 | 6 | E | 14 |
| 7 | 7 | F | 15 |
Hexadecimal Place Values
| Place (from right) | Power of 16 | Decimal Value |
|---|---|---|
| 1st | 16⁰ | 1 |
| 2nd | 16¹ | 16 |
| 3rd | 16² | 256 |
| 4th | 16³ | 4,096 |
| 5th | 16⁴ | 65,536 |
Converting Hex to Decimal
More Examples
| Hex | Working | Decimal |
|---|---|---|
| 1F | (1×16)+(15×1) | 31 |
| A0 | (10×16)+0 | 160 |
| FF | (15×16)+(15×1) | 255 |
| 100 | (1×256) | 256 |
Converting Decimal to Hex
Divide repeatedly by 16; record remainders (using A–F for 10–15). Read from bottom to top.
Hex and Binary
One hex digit equals exactly four binary digits (bits), making hex an ideal shorthand for binary data.
Real-World Uses
- Memory addresses in computers (e.g., 0x7FFF0000).
- HTML/CSS colours (#FF5733 = red-orange).
- IPv6 addresses (e.g., 2001:0db8:85a3::8a2e:0370:7334).
- Machine code, assembly language, and debuggers.
- Hex uses 16 symbols: 0–9 then A–F (A=10 through F=15).
- Place values are powers of 16: 1, 16, 256, 4096, …
- One hex digit = four binary bits.
- Hex is compact: two hex digits represent all 256 possible byte values.
Quick Practice
- Convert hex 3C to decimal.
- Convert hex 1A4 to decimal.
- Convert decimal 200 to hexadecimal.
- What colour does the CSS value #000000 represent?
- Convert binary 11111111 to hexadecimal.
Summary
Hexadecimal is the dominant number system in computing because one hex digit compactly represents exactly four binary bits. Its place values are powers of 16, and its digit set extends from 0 to F. Hexadecimal is used in memory addressing, colour coding, and countless other computing contexts.
