Skip to content
Home

Hexadecimal (base-16 numeral system)

Hexadecimal (hex) is a base‑16 positional numeral system using digits 0–9 and A–F. It compactly represents binary data and is widely used in computing, color codes, addresses, and debugging.

Overview

Hexadecimal, commonly shortened to "hex," is a positional numeral system that uses sixteen distinct symbols to represent values. The sixteen symbols are the decimal digits 0–9 followed by the six letters A–F, where A corresponds to decimal 10 and F corresponds to decimal 15. Hexadecimal is a convenient compact shorthand for binary because each hex digit encodes exactly four binary bits. It is widely used in computer science, digital electronics, and programming to display and manipulate binary data more readably.

Image gallery

3 Images

Notation and basic characteristics

Because many numbering systems can be written with the same symbols, hexadecimal values are often marked with a prefix or suffix to avoid ambiguity. Common conventions include the C/C++/Python style prefix "0x" (for example 0x1A) or the trailing "h" used in some assembly languages (1Ah). Hexadecimal digits are case‑insensitive in most contexts, so A and a both mean ten. As a positional system, each hex digit represents a power of sixteen; the rightmost digit is multiplied by 16^0, the next by 16^1, and so on.

Relation to binary and computer architecture

Because 16 is a power of two (16 = 2^4), one hexadecimal digit maps directly to a fixed four‑bit binary sequence. This makes conversion between hex and binary straightforward: split a binary string into groups of four bits (padding the leftmost group with zeros if needed) and replace each group with the corresponding hex digit. For example, the eight‑bit binary value 11011011 groups into 1101 and 1011, which map to hex digits D and B, producing 0xDB. Modern computers commonly organize memory into bytes (typically eight bits), and a byte is therefore neatly represented by two hex digits. Engineers sometimes use the term nibble (or nybble) for a four‑bit quantity.

History and terminology

The word "hexadecimal" combines Greek-derived elements meaning "six" and "ten." The system became prominent with the rise of digital computing in the mid‑20th century, when the need for compact, human-readable representations of binary data grew. Different computing environments adopted differing notation conventions (for example the 0x prefix in C-derived languages versus suffixes in assembler), but the underlying base‑16 concept is common across platforms. For background on positional systems and their uses, see the numeral system overview and the discussion of base systems.

Common applications and examples

  • Memory addresses and machine code: Hex is used by debuggers and disassemblers to display instructions and addresses compactly.
  • Color representation in web design: RGB color codes are often written as six hex digits (for example #FF7700) where pairs of hex digits encode red, green, and blue intensities.
  • Network and identification formats: MAC addresses and GUID/UUID values are typically shown in hexadecimal. IPv6 addresses are represented using hex groups separated by colons.
  • Binary dumps and diagnostics: Hexadecimal makes it easier to scan, compare, and edit raw binary data by humans.

Conversions, arithmetic, and practical tips

Converting from hex to decimal uses the positional weights 16^n. For instance, the hexadecimal number 1A3 equals 1×16^2 + 10×16^1 + 3×16^0 = 256 + 160 + 3 = 419 decimal. To convert decimal to hex, divide repeatedly by 16 and collect remainders. Simple arithmetic rules follow the same principles as in decimal but with a base of sixteen; many programming languages provide built‑in support for parsing and formatting hex values.

Notable distinctions and conventions

Hexadecimal differs from octal (base 8) and decimal (base 10) primarily in digit range and compactness relative to binary. While octal groups bits in threes, hex groups in fours, which aligns better with common byte sizes (8 bits). When reading hexadecimal numbers in different contexts, be mindful of the notation: some assemblers expect a trailing h, while many high‑level languages and documentation use 0x. The word "hex" has entered general technical jargon; related informal terms and resources can be found via computer jargon references such as nybble. For further technical details about bytes and storage units, see the entry on bytes.

Overall, hexadecimal remains an indispensable tool for anyone who works closely with low‑level data, enabling compact, aligned, and human‑readable representations of binary information.

Questions and answers

Q: What is the hexadecimal numeral system?

A: The hexadecimal numeral system is a base 16 numbering system made up of 16 symbols.

Q: What are the ten symbols used in the decimal (base 10) system?

A: The ten symbols used in the decimal (base 10) system are 0,1,2,3,4,5,6,7,8 and 9.

Q: What six extra symbols does hexadecimal use?

A: Hexadecimal uses letters taken from the English alphabet - A, B, C, D, E and F.

Q: How many bits does a single byte contain on modern computers?

A: On modern computers each byte generally contains eight bits.

Q: What do engineers and computer scientists call four-bit values?

A: Engineers and computer scientists refer to four-bit values as nibbles (sometimes spelled nybble).

Q: How can you avoid confusion with other numbering systems when writing hexadecimal numbers?

A: To avoid confusion with other numbering systems when writing hexadecimal numbers you can add a "h" after or "0x" before the number. For example 63h or 0x63 mean 63 hexadecimal.

Related articles

Author

AlegsaOnline.com Hexadecimal (base-16 numeral system)

URL: https://en.alegsaonline.com/art/43993

Share