Last Updated on October 25, 2023 by Electricalvolt

In this article, we will discuss **hexadecimal arithmetic**, covering the two basic arithmetic operations: addition and subtraction of hexadecimal numbers. Before discussing the hexadecimal arithmetic, let us first discuss the basics of hexadecimal numbers.

**Hexadecimal Number System**

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 l**owest position is 16 ^{0},** the

**upper position is 16**and so on.

^{1}Hence, this is all about the basics of hexadecimal numbers. Let us now discuss the addition and subtraction of hexadecimal numbers.

**Hexadecimal Addition**

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.

There are several different methods of performing hexadecimal addition. But in this article, we will learn to perform direct addition of hexadecimal numbers, i.e., addition of hexadecimal numbers in the base 16 number system.

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

**Example – Add (5B69)**_{16} and (7AC3)_{16}.

_{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}.

This is how we can perform hexadecimal addition. Let us now explore the hexadecimal subtraction.

**Hexadecimal ****Subtraction**

**Subtraction**

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}.

_{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.

**Solved Examples**

**Example 1**: Add the following hexadecimal number. 7AC + 6B8

Example 2: Add the following hexadecimal numbers.B6E + 8C7