Back to course

Number Systems: Decimal, Binary, and Hexadecimal

Digital Logic Systems: From Zero to Hero

2. Number Systems: Decimal, Binary, and Hexadecimal

Digital systems rely heavily on different number systems to represent data. We must understand how to move between them.

The Decimal System (Base 10)

We use the decimal system daily. It has 10 unique digits (0-9).

$$N = d_n \times 10^n + \dots + d_1 \times 10^1 + d_0 \times 10^0$$

The Binary System (Base 2)

Computers use binary, consisting only of 0 and 1. Each position represents a power of 2.

PositionWeightExample (1011)
3$2^3 = 8$1
2$2^2 = 4$0
1$2^1 = 2$1
0$2^0 = 1$1

$$1011_2 = (1 \times 8) + (0 \times 4) + (1 \times 2) + (1 \times 1) = 11_{10}$$

The Hexadecimal System (Base 16)

Hexadecimal (Hex) uses 16 symbols (0-9 and A-F). It is used as a shorthand for binary because four binary digits (bits) map directly to one hex digit.

DecimalBinaryHexadecimal
101010A
151111F

Conversion Exercise (Binary to Decimal)

Convert $11010_2$ to decimal:

$$(1 \times 16) + (1 \times 8) + (0 \times 4) + (1 \times 2) + (0 \times 1) = 16 + 8 + 2 = 26_{10}$$