Hexadecimal arithmetic and conversion to binary, octal and decimal.
Hexadecimal (base 16) uses digits 0–9 and letters A–F, where A=10, B=11, …, F=15. One hex digit encodes exactly 4 binary bits (a nibble), making hex a compact representation of binary data. A byte (8 bits) is always exactly 2 hex digits. FF in hex = 11111111 in binary = 255 in decimal = 377 in octal. Hex arithmetic works like decimal arithmetic but with base 16 carrying.
Hex to decimal
d = Σ hᵢ × 16ⁱ (sum of hex digit values × powers of 16)
Decimal to hex
Repeatedly divide by 16; remainders (read bottom-up) are the hex digits
Each hex digit maps exactly to 4 binary bits, so two hex digits represent a byte. This makes memory addresses, colour values (#RRGGBB), and binary data much more readable. For example, 0xFF = 255 is cleaner than 11111111.
0xFF = 15×16 + 15 = 240 + 15 = 255. It's the maximum value of an unsigned 8-bit integer, equivalent to 11111111 in binary.
Repeatedly divide by 16 and collect the remainders. For 255: 255 ÷ 16 = 15 rem 15 (F); 15 ÷ 16 = 0 rem 15 (F). Reading remainders bottom-up: FF.