Last Updated on October 25, 2023 by Electricalvolt

The hexadecimal has two letters, “Hexa” and “deci” that stand for the numbers “6” and “10,” respectively. The hexadecimal numbers are represented by numerals 0 through 9 and letters A through F.

A hexadecimal number system has a radix or base of 16. Hence, it has 16 distinct symbols to express numbers. These symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. Here, A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

The hexadecimal number system is a positional weight number system in which each position is determined by the power of 16. For example, the lowest position is 160, the upper position is 161 and so on.

Hexadecimal addition, or hex addition, is one of the basic arithmetic operations we can perform on hexadecimal numbers. It is used to determine the sum of two or more hexadecimal numbers.

Let us understand the addition of hexadecimal numbers with the help of examples.

Example – Add (5B69)16 and (7AC3)16.

Solution – The hexadecimal numbers are (5B69)16 and (7AC3)16. The addition of these two hexadecimal numbers is shown in the following figure.

Here is the step-by-step explanation of this addition.

Step 1 – Add the rightmost digits, 9 and 3:

(9)16 + (3)16 = (12)16 = (C)16

Hence, the sum digit is C.

Step 2 – Add the the next two digits, 6 and C:

(6)16 + (C)16 = (6)16 + (12)16 = (18)16 = (16 + 2)16

In the hexadecimal number system, 16 forms a carry 1. Hence. The sum digit is 2, and the carry is 1.

Step 3 – Add the next two digits, B and A:

(B)16 + (A)16 = (11)16 + (10)16 = (21)16

Also, there is a carry 1 from the previous step, thus

(1)16 + (21)16 = (22)16 = (16 + 6)16

Hence, the sum digit is 6, and a carry 1 for 16.

Step 4 – Add the leftmost digits, 5 and 7:

(5)16 + (7)16 = (12)16

Again, there is a carry 1 from the previous step; thus,

(1)16 + (12)16 = (13)16 = (D)16

Here, the sum result is less than 16; hence, there is no carry, and the sum digit is D.

Therefore, the final result of adding these two hexadecimal numbers is (D62C)16.

Subtraction is another basic operation in hexadecimal arithmetic. It is used to determine the difference between two hexadecimal numbers.

We can perform hexadecimal subtraction just like decimal subtraction. The only difference is in the borrowed number. That means we consider 16 as a borrow instead of 10 in the hexadecimal number system.

Let us see an example to understand the subtraction of hexadecimal numbers.

Example – Subtract (1A70)16 from (1ADB)16.

Solution – The hexadecimal numbers are (1ADB)16 and (1A70)16. The subtraction of (1A70)16 from (1ADB)16 is below.

Here is the step-by-step explanation of this hexadecimal subtraction.

Step 1 Subtract the rightmost digits, 0 from B:

(B)16 – (0)16 = (B)16

The difference digit is B.

Step 2 – Subtract the next two digits, 7 from D:

(D)16 – (7)16 = (13)16 – (7)16 = (6)16

Hence, the difference digits is 6.

Step 3 – Subtract the next two digits, A from A:

(A)16 – (A)16 = (0)16

Hence, the difference digit is 0.

Step 4 – Subtract the leftmost digits, 1 from 1:

(1)16 – (1)16 = (0)16

Hence, the difference digit is 0.

Thus, the final difference is (006B)16.

This is how we can easily subtract two hexadecimal numbers.

Conclusion

In this article, we have discussed the addition and subtraction of hexadecimal numbers. The hexadecimal addition and subtraction are two important operations used in various electronic systems like microcontrollers, keyboards, etc. Here, we have learned these two operations of hexadecimal arithmetic with the help of an example.