# Hexadecimal

Source: https://wisconsin.twango.dev/sp25-cs252/reference/hexadecimal

# Hexadecimal

Hexadecimal is a base-16 number system. It uses 16 symbols to represent numbers. The symbols are `0-9` and `A-F`. The `A-F` symbols represent the numbers `10-15`, respectively.

Hexadecimal provides a convenient way to represent binary numbers. Each hexadecimal digit represents four binary digits. This is because $16 = 2^4$.

| Binary | Hexadecimal | Decimal |
|--------|-------------|---------|
| 0000   | 0           | 0       |
| 0001   | 1           | 1       |
| 0010   | 2           | 2       |
| 0011   | 3           | 3       |
| 0100   | 4           | 4       |
| 0101   | 5           | 5       |
| 0110   | 6           | 6       |
| 0111   | 7           | 7       |
| 1000   | 8           | 8       |
| 1001   | 9           | 9       |
| 1010   | A           | 10      |
| 1011   | B           | 11      |
| 1100   | C           | 12      |
| 1101   | D           | 13      |
| 1110   | E           | 14      |
| 1111   | F           | 15      |

## The Hexadecimal Prefix

In programming, hexadecimal numbers are often prefixed with `0x`. This is to distinguish hexadecimal numbers from other number systems. For example, `0x10` is a hexadecimal number, while `10` is a decimal number.

Related: [[lectures/lecture-02]], [[lectures/lecture-03]], [[lectures/lecture-04]], [[lectures/lecture-05]]

## Source

Original retained in wisconsin-legacy.
