In a previous blog, I talked about hexadecimal and the symbols used to represent numbers in it. Today, I will be explaining how to add and subtract hexadecimal numbers or hex for short. I will be only be dealing with positive numbers as negatives numbers are very complicated in both binary and hexadecimal. Now lets get started!
Adding in hex is very similar to binary. First, you set it up like you are adding base ten numbers in math class. Then, you add the right most digits. If those two digits add up to more than 16, subtract 16 from that number and add one to the digit to the left. Repeat until the number is added out. I have shown an example below:
Add B4 and FO in base 16
B4 (180 in base 10) +FO (240 in base 10) 1A4 (420 in base 10) As you can see (B+F is 26. 26-16 is 10 or A)
Subtraction in hex is also very similar to subtraction in binary. First you set the equation up like above, but you use a subtraction sign instead of addition. Then you subtract the right-most digits. If the digit being subtracted is larger than the one above, you “borrow” one from the digit to the left which increases the value that you found by 16.
Subtract 1F from 7A in base 16
7A (122 in base 10) -1F (31 in base 10) 5B (91 base 10)
If you want to check your answers, convert all numbers to base 10 and add or subtract them. If you need more practice, here are some more questions below. Answers are posted under the Youtube video.
- Add 8F and F9
- Add ABC and 159
- Add 123, 456, and 789
- Subtract 5D from 8A
- Subtract 5DC from 7FA
- Subtract ABC and 598 from 1F0D
If you are still confused, please watch this Youtube video. Ignore the part where he put 8+B = 13.