Home  »  ArticlesGuidesProgrammingTechnology   »   How to do Hexadecimal Arithmetic by Examples

# How to do Hexadecimal Arithmetic by Examples

In a recent article, we showed you how to do Binary Arithmetic by example and went on to explain how important Binary number systems are. In this article, we will be talking about how to do Hexadecimal Arithmetic with simple to understand examples.

As you will see, doing additions and subtractions in hexadecimal as well as doing hexadecimal multiplication and division is rather simple. It just takes some getting used to. As long as you can perform these arithmetic equations in decimal then you can do them in hexadecimal.

The important thing to remember is that whatever number system you use, the same rules apply. You just need to know when to borrow or carry forward in subtraction and addition respectively. If you are not familiar with what hexadecimal numbers are we have an article on this site explaining them in more detail.

Take note that this guide will be focusing on just the four basic arithmetic operations as follows… Note: To help you understand what’s going on, the Hexadecimal representations of the sequence of digits are as follows `[0,1,2,3,4,5,6,7,8,9,A,B,C,D,E.F]`.

Notice where decimal 10 would appear we keep going since the Hexadecimal needs to reach sixteen digits before going to the next level. For purposes of easy translations let’s replace the above with the equivalent decimal representations as follows `[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]`.

We can now use what we have above in our hexadecimal arithmetic

`````` 5 (or 5 decimal)
+5
--
A (or 10 decimal)``````

How about a more over-the-top example.

`````` A (or 10 decimal)
+A
--
14 (This is not 14 decimal but (F x 1 and 4 = 20 decimal)``````

`````` 10
+10
---
20``````

Take 20 divide by 16 = 1
Take the remainder = 4 and string them together = 14 Hexadecimal (20 decimal)

As for the rest of the Hexadecimal Arithmetic calculations, That is the Subtraction, Multiplication, and Division, all follow the rules as other Number systems. You just need to remember whenever you carry or borrow from the next column of digits you are borrowing or carrying sixteen rather than 10 in decimal or 2 in binary.

The reason why it is not exactly beneficial to show examples of these as we have done with the Binary Arithmetic guide is that each number has its challenges and the best way is to convert hexadecimal to a different number system, do the arithmetic then convert back to hexadecimal. This will be a much faster and more efficient process. We will show you how to do it in the next guide on converting between the common number systems.