Hexadecimal
Hexadecimal (hex) is the base-16 numeral system, using 0-9 and A-F for 0-15; it is one of the most common radix notations in computing.
Purpose
It represents binary data more compactly and byte-aligned — each hex digit corresponds to exactly 4 binary bits — making values easier for humans to read and align with hardware and protocol fields.
Mechanism
Each hexadecimal digit corresponds to 4 binary bits (a nibble). Values expand by positional weight: N = d_n×16^n + ... + d_0×16^0. A byte's high and low nibbles each yield one hexadecimal character.
Use cases
- Debug output of memory addresses and register values
- Color values (#FF8800)
- Network protocol fields
- Machine code display for assembly
Examples
- Input
255OutputFF255 = 15×16 + 15
Common errors
- Using a leading 0x in JSON numbers (JSON has no hexadecimal literals)
- Store hexadecimal as strings or use decimal numbers
Related terms
Base16
Base16 is hexadecimal encoding: every 4 bits map to one hexadecimal character (0-9, A-F), making it the simplest member of the Base family defined by RFC 4648. GLOSSARY
Octal
Octal is the base-8 numeral system, using digits 0-7, where each digit corresponds to 3 binary bits; it was widely used on early computers. GLOSSARY
Binary
Binary is the base-2 numeral system, using only 0 and 1, and is the foundation of internal data representation in all digital electronic computers. GLOSSARY