Definition
Hexadecimal (often abbreviated as “hex”) is a base‑16 numeral system that uses sixteen distinct symbols to represent values. The symbols are the ten decimal digits 0–9 and six additional letters A–F (or a–f), where A represents 10, B 11, C 12, D 13, E 14, and F 15. Each hexadecimal digit corresponds to four binary bits, making it a convenient compact representation of binary data.
Historical development
The use of hexadecimal notation in computing dates to the early 1950s, when engineers needed a more readable way to express binary machine code and memory addresses. Early computers such as the IBM 701 and the UNIVAC series employed hexadecimal for debugging and documentation. The term “hexadecimal” itself derives from the Greek “hex” (six) and the Latin “decimal” (ten), reflecting the combination of six additional symbols with the ten decimal digits.
Notation and conversion
A hexadecimal number is typically prefixed to indicate its base, for example:
0x1A3F(C/C‑style prefix)h'1A3F'(VHDL style)1A3F₁₆(subscript)
Conversion between hexadecimal and binary is straightforward: each hex digit expands to a four‑bit binary group. Conversion to decimal involves multiplying each digit by 16ⁿ, where n is the digit’s positional index (starting from 0 for the least‑significant digit).
Applications
- Computer programming: Hexadecimal is widely used for defining memory addresses, machine code, and color codes in web design (e.g.,
#FF5733). - Digital electronics: Designers employ hex to label register contents and instruction opcodes.
- Data encoding: Hex dumps display raw binary files in a human‑readable form.
- Networking: MAC addresses and IPv6 address segments are expressed in hexadecimal.
Advantages
- Compactness: Hexadecimal representation reduces the length of binary strings by a factor of four.
- Alignment with binary: Each hex digit aligns with a whole number of bits, simplifying bitwise manipulation and hardware documentation.
Limitations
- Not a positional system for everyday arithmetic; calculations are generally performed in decimal or binary before conversion to hex for presentation.
Related numeral systems
- Octal (base 8) – uses digits 0–7.
- Binary (base 2) – uses digits 0 and 1.
- Base‑64 – employs a larger set of characters for efficient data encoding.
References
- J. L. Hennessy & D. A. Patterson, Computer Architecture: A Quantitative Approach, 5th ed., Morgan Kaufmann, 2011.
- R. G. Knuth, The Art of Computer Programming, Volume 1: Fundamental Algorithms, 3rd ed., Addison‑Wesley, 1997.
- IEEE Standard 754‑2008, “Standard for Floating‑Point Arithmetic,” 2008.