What Is Hexadecimal? Base-16 Number System Explained
Hexadecimal (base-16) is a number system that uses 16 digits: 0–9 and A–F, where A=10, B=11, C=12, D=13, E=14, F=15. Each hex digit represents exactly 4 bits, making hexadecimal a compact way to represent binary data — one byte (8 bits) is just two hex digits.
Decimal to Hex Conversion
To convert decimal to hex, repeatedly divide by 16 and record the remainders. Example: 255 ÷ 16 = 15 remainder 15 (F); 15 ÷ 16 = 0 remainder 15 (F). Reading remainders bottom-up: 255 = 0xFF. Alternatively, 255 in binary is 11111111, split into 1111 1111, each group = F, giving FF.
Where Hexadecimal Is Used
Hex appears throughout computing: HTML/CSS color codes (#FF5733), memory addresses (0x7fff5fbff8c0), cryptographic hashes (SHA-256 produces 64 hex chars), byte values in network protocols, hardware register values in embedded systems, and character escape sequences in programming (\x41 = 'A').
Hex vs Binary vs Octal
Binary (base-2) uses 0 and 1 — the native language of hardware, but verbose for humans. Octal (base-8) was used in early Unix systems (file permissions: 0644 = 110 100 100 in binary). Hexadecimal (base-16) is the most compact human-readable form for binary data and is preferred in modern computing.