• It is commonly known as ‘hex’
• It is a base 16 number system.
• It uses 16 digits values to represent each digit.
• For the first ten digits from 0 to 9, it uses the same numbers.
• However, for 10 to 15 it makes use of A to F.
• That is, A=10, B=11, C=12, D=13, E=14, F=15.
• It follows the same rule as binary and denary numbers with base 16x.
• For a typical 5-digit hex number, the headings will be,

• 16 equals 24 meaning that, a hex number can be represented in binary using four bits.


2516 = 25H = 2 x 161 + 5 x 160 =37

2E16 = 2EH = 2 x 161 + 14 x 160= 46

AC1116 = AC11H = 10 x 163 + 12 x 162+ 1 x 161 + 1 x 160 = 40960 +3072 + 16 + 1 = 44049

• Here, ‘H’ represents the hex prefix.

Why Use Hexadecimal Number System?

• On daily use, it is not convenient to interact in binary numbers for humans.
• As a result, a more convenient way was needed.
• A byte contains 8-bits and represents values 0000 0000 to 1111 1111 (0 to 255).
• The 8-bits of a byte are divided into two groups i.e. top 4 bits and low 4 bits.
• The 4 bits of a byte can give values from 0 to 15 therefore, a base 16 number system was introduced.
• Using the base 16 representation, a byte can be represented by 2 hex digits instead of 8-bits.
• Working through a binary number with base 16 is much easier.
• E.g. If you have AF, you can determine its value by simple multiplication (10 x 161 + 15 x 160) = 75 or 0100 1011.

Binary to Hexadecimal Conversion:

• Let’s take an example binary number, 1 0 0 0 0 1 1 1 1 1 1 1 0 1.
• Starting from right to left, group it into sets of 4 bits. _ _10 0001 1111 1101
• If the last set doesn’t make 4 bits, add 0s that will make it, 0010 0001 1111 1101
• Now find out the values of each set individually and then combine the digits.

• Combine the converted hex digits together i.e. 21FD.

Hexadecimal to Binary Conversion:

• Consider an example hex number, BF08.
• Find the equivalent 4-bit binary representation of each hex digit.

• Combine the 4-bits groups together i.e. 1011111100001000.

Hexadecimal to Denary Conversion:

• To convert a hex number to denary, multiply each digit with its value.
• Consider the number, C8F.

• Add these numbers together to get the denary value of the hex number i.e. 3072 + 128 + 15 = 3215.

Denary to Hexadecimal Conversion:

•  Just like denary to binary, denary to hexadecimal conversion can be done with any of the two methods i.e. ‘try and error’ and ‘repetitive division.

Method 1 – Try and Error:

• Consider the denary number 2004. 
• Try to place hex digits below 162, 161 and 160 and to find the hex representation.
• As compared to denary to binary, denary to hex ‘try & error’ method is much more complex.

• This table show, the denary number 2004 is 7 lots of 256 (1792), 13 lots of 16 (208) plus an extra 4.

Method 2 – Repetitive Division:

• In this method, the number required to be converted in hex is divided repetitively with 16.
• The remainder is then read from bottom to top.
• Let’s take 2004 in denary and convert it into hexadecimal.

Uses of Hexadecimal Numbers

Memory Dumps:

• A hex number system is often used when new software is developed to trace errors.
• The computer memory can solve many problems.
• Memory dump can be represented as the memory content that is the output to a monitor or a printer.

• The figure above shows the memory location on the far-left side and hex codes against these memory locations.
• Developers can determine errors from these hex codes to find out where in the memory the fault occurs.
• Tracing errors using hex numbers is very efficient compared to the binary numbers.
• A hex number system is a powerful tool for fault and error tracing, but it requires computer architect knowledge.

HTML (HyperText Mark-up Language):

• It is a language that is most often used to make the text more presentable. E.g. to change the color.
• It uses to bracket pieces of codes. E.g. marks the start of the code cell and ends it.
• Whatever is written between and is defined.
• Different hex values represent different colors:

• The hex value for any color can be generated and there are some websites available that allow the user to generate HTML code for any color.

MAC Address (Media Access Control):

• The MAC Address represents a unique number that helps in identifying any device on the internet.
• It is 48 bits number i.e. represented by 6 groups of 12 hex numbers. E.g. NN-NN-NN-DD-DD-DD or NN:NN:NN:DD:DD:DD.
• The first of this number represents the manufacturer ID and the second half represent the device’s serial number.
• Sometimes lower-case hex numbers are also used in the MAC address.
• It is a Network Interface Card (NIC) of the device.

Examples of Manufacturer Identity:

Web Addresses:

• The ASCII codes of the characters typed through a keyboard can also be represented using the hex values.
• One example of the use of ASCII code is the URL or web address

Assembly Code & Machine Code:

• The 8-bit computer registers have the largest number 1111 1111 (8-bits).
• The hex representation of this largest number is FF.
• The computer uses 8-bit binary numbers but for programmers’ convenience assembly language is used which uses hex numbers.
• In assembly language, hex value can be moved using command MOV.
• E.g. MOV AX, 03 where AX represents the register and 03 is the value that will be moved to the register.

© 2019-2022 O’Level Academy. All Rights Reserved