Hexadecimal Definition

Hexadecimal refers to the base-16 number system, which consists of 16 unique symbols, in contrast to the ten unique symbols of the commonly used decimal (i.e., base 10) numbering system.

The numbers 0 through 9 are the same in both systems; however, the decimal numbers 10 through 15 are represented by the letters A through F. Thus, for example, the decimal number 11 is represented by B in the hexadecimal system and decimal 14 is represented by E.

The hexadecimal system is commonly used by programmers to describe locations in memory because it can represent every byte (i.e., eight bits) as two consecutive hexadecimal digits instead of the eight digits that would be required by binary (i.e., base 2) numbers and the three digits that would be required with decimal numbers. In addition, it is much easier for humans to read hexadecimal numbers than binary numbers, and it is not much more difficult for computer professionals to read hexadecimal numbers than decimal numbers.

Moreover, conversion between hexadecimal and binary numbers is also easy after a little practice. For example, to convert a byte value from hexadecimal to binary, all that is necessary is to translate each individual hexadecimal digit into its four-bit binary equivalent.

Hexadecimal numbers are indicated by the addition of either an 0x prefix or an h suffix. For example, the hexadecimal number 0x2F5B translates to the binary number 0010 1111 0101 1011.

int 0x80 is the assembly language instruction that is used to invoke system calls in Linux on x86 (i.e., Intel-compatible) processors. The 0x in it indicates that it is not a decimal 80 but rather a hexadecimal 80 (which is a decimal 128). A system call is a request in a Unix-like operating system made by a process for a service performed by the kernel.

A common use of hexadecimal numbers is to describe colors on web pages. Each of the three primary colors (i.e., red, green and blue) is represented by two hexadecimal digits to create 255 possible values, thus resulting in more than 16 million possible colors. For example, the HTML (hypertext markup language) code telling a browser to render the background color of a web page as red is   <body bgcolor="#FF0000"> and that telling it to render the page as white is   <body bgcolor="#FFFFFF">.

Created September 14, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.