8 of 9

LESSON 8 · The Secret Life of Numbers

Convert Across Bases

Read the same number in three bases. Take the decimal number 42. In binary (base-2), each position is a power of 2: 42 = 32 + 8 + 2 = 101010. In hexadecimal (base-16), 42 = 2 × 16 + 10 = 2A.

Now try 255. In base-16 it is FF — the brightest channel value in RGB hex colors. In binary it is 11111111 (eight 1s), which is why an 8-bit byte holds exactly 0 through 255.

Apply it: open your phone calculator and switch to programmer mode. Type a decimal number and watch it appear in binary, octal, and hex at once. A few minutes shows why programmers think in hex — it is compact binary.