The hexadecimal number system comprises of four binary numbers, which is represented with base-16.

“Decimal” means 10, “binary” means 2, and the word “hexadecimal” means 16.

The hexadecimal number system is a digital number system that uses 16 different digits from 0-to-9 and A-to-F.

#### Why you need a hexadecimal number?

Our digital systems, similar to a computer, use a binary number system.

The binary number system can be represented in 8, 16, and even 32 bits, making it difficult to read and write without creating any errors.

To overcome this problem, later on, the binary number is grouped into 4-bits. And this group of 4-bits uses a different number system known as the hexadecimal number system.

Thus, the hexadecimal number system shortens the long binary number of “0” and “1” and make it easier to read and write.

For **instance**, the binary number **1101 0101 1100 1111 _{2}**Â is equivalent to hexadecimal number

**D5CF.**Now,

**hexadecimal notation**is easy to read and understand than before.

#### How is the hexadecimal number system implemented?

As we know, the binary number uses “**0**” and “**1**,” and the decimal number uses digits from **zero to nine**.

Both the binary and decimal number system uses a single digit and is separated with base-2 and base-10.

But, in hexadecimal, we cannot use double-digit, which is in decimal numerals of 10, 11, 12, 13, 14, and 15.

The double-digit create confusions with binary and decimal number system. For instance, 10 in hexadecimal can be expressed in decimal number as 10 or binary number as 1,0.

To avoid such a problem, the hexadecimal number in double-digit from 10 to 15 is expressed as A, B, C, D, E, and F, respectively.

This how the hexadecimal number is expressed from **0 to 9** and the **capital letter A to F**.

### Relationship between binary numbers and hexadecimal number

The hexadecimal number has base-16, and the 16 in decimal can be represented as the fourth power of 2 (or 2^{4}). This has a direct relation with binary numbers with base-2.

So, one hex digit is equivalent to 4 binary digits.

**1 hexadecimal digit = 4 binary digits**

Also, hexadecimal makes it easy to write large binary digits into fewer hexadecimal digits.

Moreover, we know that 1 nibble is equivalent to 4-bits and 4-bits equal to one hexadecimal number.

So, one hexadecimal number is also to be thought of as one nibble or half-a-byte.

**1 hexadecimal = 1 nibble = 1/2 byte = 4 bits**

Therefore, two hexadecimal digits are equivalent to one byte, which ranges from **00** to **FF**.

**2 hexadecimal digits = 1 byte**

Like, 00, 01,….2F…,FE,FF.

Also, to understand clearly,Â you can follow the guide that shows the difference between bits and bytes.

### How to distinguish hexadecimal numbers from decimal numbers?

Each digit has a weight or value of 10 starting from the Least Significant Bit (LSB) in a decimal number.

Similarly, in a hexadecimal number, each digit has a weight or value of 16, increasing as we move from right to left.

Moreover, hexadecimal uses the base-16, separated from the decimal number by **adding the subscript 16** like **D5E3 _{16Â }**or

**5892**

_{16}.Also, to distinguish the hexadecimal number from a decimal number, we can use a **prefix like** “**#**” (Hash) or a “**$**” (Dollar sign).

So, the value of the hexadecimal number would look like **#FE78** or **$FE78.**

### Relationship between decimal, binary, and hexadecimal number.

As we know that the decimal number is expressed in digits from 0 to 9.

Here, the hexadecimal is already using the original decimal number from 0 to 9, but the decimal number from 10 to 15 are expressed in a letter from A to F

Let’s look into the table that depicts the relationship between decimal number, binary number, and hexadecimal number.

Decimal number | 4-bit binary number | Hexadecimal number |
---|---|---|

0 | 0000 | 0 |

1 | 0001 | 1 |

2 | 0010 | 2 |

3 | 0011 | 3 |

4 | 0100 | 4 |

5 | 0101 | 5 |

6 | 0110 | 6 |

7 | 0111 | 7 |

8 | 1000 | 8 |

9 | 1001 | 9 |

10 | 1010 | A |

11 | 1011 | B |

12 | 1100 | C |

13 | 1101 | D |

14 | 1110 | E |

15 | 1111 | F |

16 | 0001 0000 | 10 (1+0) |

17 | 0001 0001 | 11 (1+1) |

Continuing in a group of 4-bits | ||

255 | 1111 1111 | FF |

### Binary number to Hexadecimal number conversion

As we have stated in the above table, the possible value of 4-bits is denoted in hexadecimal notation.

Now, let’s take an example **1101 1100 1000 1010 _{2}**. This binary number can be converted into a hexadecimal number as

**DC8A**.

Let’s look at the process with **another example.**

Convert **10101110 _{2}**Â into its hexadecimal number

10101110_{2} |
|||

Group the bits into four-digit starting from right to left | |||

= | 1010 | 1110 | |

Find the equivalent decimal value of each group. | |||

= | 10 | 14 | (in Decimal) |

Convert the decimal number into a hexadecimal number | |||

= | A | E | (in Hex) |

The hexadecimal number is AE_{16} |

### Hexadecimal to binary and to decimal conversion

In this process, we must first find the binary equivalent of each hexadecimal digit and then binary number to decimal number.

Let’s convert the hexadecimal number 3FA9 into its binary equivalent and then into the decimal equivalent.

**3FA9 _{16}**

= **0011 1111 1010 1001 _{2}**

= (8192+4096+2048+1024+512+256+128+32+8+1)

= **16,297 _{10}**

### How to start counting using hexadecimal numbers?

As we know that first counting from 0 to F is equal to 4-bits. If we further start to count that is beyond F, then we have to add another 4-bits.

So, the first counting in a single hexadecimal digit is 0…9…A, B, C, D, E, F.

The two-digit hexadecimal counting starts with 10 (0001 0000). Here, the first digit change from 0 to F by keeping 2nd digit constant like 10,11,12,…1A,1B,..1F.

After that, we increase the second digit from 1 to 2 and change the first digit from 0 to F like 21, 22, 23,…2A,2B..2F.

Likewise, we can count two-digit hexadecimal number until we reach **FF (1111 1111)**, equivalent to **255 in decimal number**.

So, the final count in the three-digit hexadecimal number will be **FFF _{16} (4095_{10}),** and the four-digit hexadecimal number will be

**FFFF**.

_{16}(65535_{10})### Takeaway

The hexadecimal numbering system, in short, known as **hex**, is denoted with base-16 because it consists of 16 digits from 0-to-9 and A-to-F.

The hexadecimal number reduces large binary numbers into sets of 4-bit.

To convert binary to hexadecimal, we have to group four digits from right to left. After that, look for equivalent hexadecimal digits.

Moreover, the hexadecimal number is used to represent the format of Internet Protocol version 6 (IPv6).