Nepedia
Back to Discover
Advanced Reader
🔢

Hexadecimal

math Maturity 7-9 Next article →

Hexadecimal, often called "hex" for short, is a positional numeral system using base 16. In our everyday decimal system, we use ten digits from 0 to 9. Hexadecimal expands this set to include sixteen distinct symbols. The first ten symbols are the standard numbers 0 through 9. To represent the values from 10 to 15, the system uses the letters A through F. These letters can be written in either uppercase or lowercase without changing their value.

Hexadecimal multiplication table
Hexadecimal multiplication table

This system is particularly important in the world of computing. Most computer hardware operates using binary, which is a base-2 system. Because 16 is a power of 2, hexadecimal provides a dense way to represent binary data. A single hex digit represents exactly four contiguous bits, a unit known as a nibble. When you group two hex digits together, they represent an 8-bit byte. This relationship makes it much easier for humans to read and manage long strings of binary code.

Hexadecimal-counting
Hexadecimal-counting

Because hexadecimal looks similar to decimal, programmers use specific notations to identify it. In mathematics, a subscript is often used to show the base. For example, writing 159₁₆ tells the reader the number is in hex, while 159₁₀ indicates decimal. In the C programming language and many related languages, the prefix "0x" is used to denote a hex literal. For instance, 0x42 is a hexadecimal number. Other environments use different prefixes, such as the dollar sign ($) in Pascal or Delphi.

History shows that different computer architectures used various methods to represent these sixteen values. During the 1950s, some machines like the Bendix-14 used numbers 0 through 5 with an overline. The SWAC and Bendix G-15 computers used lowercase letters u, v, w, x, y, and z. Other machines, like the ORDVAC and ILLIAC I, used uppercase letters K, S, N, J, F, and L. The PERM computer in 1956 even used the letter O to represent zero. These variations show how early computing was still finding its standard ways of communicating numbers.

Some experts even questioned the standard A through F convention. In 1968, Bruce Alan Martin of Brookhaven National Laboratory suggested that the A–F choice was "ridiculous." He proposed a new set of symbols based on bit locations.

Bruce Martin hexadecimal notation proposal
Bruce Martin hexadecimal notation proposal

Later, in 1972, Ronald O. Whitaker proposed a triangular font designed for "direct binary reading." This font aimed to allow computers to read input and output without needing complex encoding matrices.

Base-16 digits
Base-16 digits

Hexadecimal is used in many modern digital systems you might encounter. In web design, HTML and CSS use hex codes to define colors. A color can be expressed using six hex digits, representing the red, green, and blue components in order. For example, #FF0000 represents pure red. Hex is also used in URIs and character references in XML. In the Unicode standard, character values are shown as a hex number. Even IPv6 addresses use groups of four hex digits, known as hextets, separated by colons.

Beyond simple counting, hex can represent complex data types. It can express bit patterns in a processor, including signed numbers or floating-point values. For example, the negative decimal number −4210 can be written as FFFFFFD6 in a 32-bit CPU register using two's complement. Hex can even be used in exponential notation, called P notation, to represent very large or small numbers. This is required by the IEEE 754-2008 standard for binary floating-point numbers. By providing a compact way to view binary, hexadecimal remains a vital bridge between human logic and machine code.

585 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (5)
File:Bruce Martin hexadecimal notation proposal.png
Bruce Martin hexadecimal notation proposal.png
File:Base-16 digits.svg
Base-16 digits.svg
File:Hexadecimal-counting.jpg
Hexadecimal-counting.jpg
File:Hewlett-Packard Model HP-16C Programmable RPN Calculator, HP's First and Only Calculator esp. for Programmers, built 1982-1989 (edited to rectangular, V2).jpg
Hewlett-Packard Model HP-16C Programmable...
File:Hexadecimal multiplication table.svg
Hexadecimal multiplication table.svg
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.