### Ticker

6/recent/ticker-posts

# L5, Hexadecimal System, Conversion of Hexadecimal number into Binary and vice versa , package q10855

Conversion of Hexadecimal number into Binary and vice versa :-

The numbering system which uses base-16 is called hexadecimal system (or simply hex).

In binary (base-2) a total of 2 digits (0 and 1) are used to represent a number of any size (magnitude) and in octal (base-8) a total of 8 digits (0 to 7) are used.

Similarly in hexadecimal system (base-16), a total of 16 digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) are used to represent a number of any size (magnitude).

The highest digit in hex is (F)16. The number (F)16 in binary is represented as (1111)2. You will notice that we are using four binary digits (bits) to represent the highest hexadecimal digit.

In hex to binary conversion, we will have to use four bits to represent each hex digit.

The following table shows the conversion of each hex digit into their corresponding binary digits.

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

For example, hexadecimal number 0x5AF6 is converted into binary as:

```Hex Number    ->    5    A    F    6
Binary Number ->  0101 1010 1111 0110```
`Hence, 0x5AF6 is (0101101011110110)2`

Similarly while converting a binary number into a hex number, we first divide the binary number into groups of 4 digits each, starting from the right most side. Each of these four binary digits are replaced with their corresponding octal digits.

In case we find that the left most group of binary digits do not have four digits, we prefix the required number of zeros to make it four binary digits.

For example, let us try convert a binary 1101100 into hex.

```Binary Number ->    110 1100
Binary Number ->    0110 1100  // After prefixing zeros in the left most group
Octal Number  ->      6    C
```

Hence, the hex equivalent of the given binary 1101100 is 0x6C

Select all the correct statements given below.
• (F3G9)16 is a hexadecimal number.
• Each hexadecimal digit is represented as three bit binary number.
• Binary number (10101110)2 is equivalent to the hexadecimal number (AE)16.
• Hexadecimal number (369)16 is equivalent of binary number (1101101001)2.