# Converting Hexadecimal to Binary

### Hexadecimal Numbering System

Hexadecimal is a base 16 numbering system which is made up of 16 digits: 0 – 9 and six more, which is A through F.

### Uses of Hexadecimal

Hexadecimal numbering system is often used by programmers to simplify the binary numbering system.  Since 16 is equivalent to 24, there is a linear relationship between the numbers 2 and 16.  This means that one hexadecimal digit is equivalent to four binary digits.  Computers use binary numbering system while humans use hexadecimal numbering system to shorten binary and make it easier to understand.

### Binary Numbering System

Binary is a base 2 numbering system which is made up of two numbers: 0 and 1.  0 means OFF and 1 means ON.  The computer’s central processing unit (CPU) only recognizes these two states – ON and OFF.  It is the foundation for all binary code, which is used in computer and digital systems.

### Bits and Bytes

A binary digit called bit is the smallest unit of data in a computer.  Each bit has a single value which is either 0 or 1.  8 bits (b) is equivalent to 1 byte (B).

### Conversion from Hexadecimal to Binary

Conversion can be done by converting each hexadecimal digit to 4 binary digits based on the following table:

 Hexadecimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 A 1010 B 1011 C 1100 D 1101 E 1110 F 1111

Example: 3B29, convert each digit as follows:

3 is converted to 0011

B is converted to 1011

2 is converted to 0010

9 is converted to 1001

So hexadecimal number 3B29 is equivalent to 0011101100101001 in binary.

## Conversion from Binary to Hexadecimal

Conversion can be done in two ways:

1. Basic Conversion – this is used for binary numbers with four or less digits.
• Start with four binary numbers to convert. If the binary has less than 4 digits, just add zeroes to the front to make it 4 digits.

Example: 1010
If you have 01, make it 0001.

• Put the binary number on the power of 2 columns as follows:
 Exponent 23 22 21 20 Value 8 4 2 1 Binary 1 0 1 0

• Take the corresponding value of each binary digit equal to 1 and add to get the total value. The total value corresponds to the decimal equivalent.

Total value = (8 + 2) = 10
So binary number 1010 is 10 in decimal number.

• Convert decimal to hexadecimal.

Decimal number 10 is A in hexadecimal. Refer to the table below.
So binary number 1010 is equivalent to A in hexadecimal.

 Hexadecimal Decimal 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 A 10 B 11 C 12 D 13 E 14 F 15

1. Conversion of Long Binary Numbers – this is used for binary numbers with more than four digits.
• Break the string of binary numbers into groups of four, from right to left. If the leftmost binary has less than 4 digits, just add zeroes to the front to make it 4 digits.

Example: 11101100101001
11 1011 0010 1001
(0011) (1011) (0010) (1001)

• Convert each group at a time using the Basic Conversion method discussed earlier.

0011 = (2 + 1) = 3
1011 = (8 + 2 + 1) = 11 = B
0010 = 2
1001 = (8+1) = 9

• Put together the converted value of each group.

So binary number 11101100101001 is 3B29 in hexadecimal.