Hexadecimal Numbering System
The hexadecimal or base-16 numbering system is commonly used as a condensed representation of a binary number, since each hexadecimal digit is equivalent to four binary digits.
The main characteristics of the hexadecimal numbering system are that:-
- each digit varies in the range 0 to 15,
- moving to the left, each digit is worth sixteen times as much as the digit immediately to its right.
The octal or base-8 numbering system is an alternative to hexadecimal, in which each octal character is equivalent to three binary digits.
A single hexadecimal digit may take any value between 0 and 15. Numbers 0–9 are used as in the decimal system, while values in the range 10–15 are represented by letters of the alphabet A, B, C, D, E and F, as shown in the following table.
Converting Between Binary and Hexadecimal
Conversion between binary and hexadecimal is based on swapping groups of 4-bits with the equivalent hexadecimal digit. Unfortunately, there is no easy way to remember the associated 4 bit binary codes for the letters A to F, other than regular practice. However, the above table may easily be drawn from first principles, if required.
Binary to Hexadecimal Conversion
When converting between the binary and hexadecimal numbering systems, each group of 4 bits starting at the right hand side is converted into a single hexadecimal digit. This approach is illustrated by the following example, which converts the binary number 111 1010 1100 11102 giving the result 7ACE16.
Hexadecimal to Binary Conversion
To convert a hexadecimal number to binary, each hexadecimal digit is replaced by the equivalent 4-bit code. The following example converts the hexadecimal number 4FD716 to binary, giving the result 100 1111 1101 01112.
See the Numbering Systems Problems page for additional practice activities. Windows users may check their results by using the Windows Calculator in programmer's view.