Below Are Hex Calculators, Which you can use for Calculate these formula. So let's have a look at them from below.
Hexadecimal Number System
Hexadecimal number system (Hex) is just like decimal and binary number system. Where in decimal system the base is 10 and in binary system the base is 2, the base in hexadecimal system is 16. In Hex, we use digits 0-9 and alphabets A to F. The decimal numbers 0-9 are same in Hex system but for decimal numbers 10-15, we have A-F in Hex. For decimal numbers 16-25, we resume our counting of Hex from 10. Since we mostly use decimal numbers, it is easier to understand Hex in terms of decimal numbers. The following table shows how each number in decimal has an equivalent number in Hex.
Hex | Dec | HEX | DEC | HEX | DEC |
---|---|---|---|---|---|
0 | 0 | 10 | 16 | 20 | 32 |
1 | 1 | 11 | 17 | 21 | 33 |
2 | 2 | 12 | 18 | 22 | 34 |
3 | 3 | 13 | 19 | 23 | 35 |
4 | 4 | 14 | 20 | 24 | 36 |
5 | 5 | 15 | 21 | 25 | 37 |
6 | 6 | 16 | 22 | 26 | 38 |
7 | 7 | 17 | 23 | 27 | 39 |
8 | 8 | 18 | 24 | 28 | 40 |
9 | 9 | 19 | 25 | 29 | 41 |
A | 10 | 1A | 26 | 2A | 42 |
B | 11 | 1B | 27 | 2B | 43 |
C | 12 | 1C | 28 | 2C | 44 |
D | 13 | 1D | 29 | 2D | 45 |
E | 14 | 1E | 30 | 2E | 46 |
F | 15 | 1F | 31 | 2F | 47 |
Hex conversion
There’s no way we can remember this table or draw it every time we are using Hex system, but we can easily convert from decimal system to Hex and vice versa. If you know how to convert from binary to decimal or from decimal to binary, Hex conversion will be very easy for you because it is similar to binary conversion.
Hex to Decimal
Lets’ start by converting a Hex number (4FD in this case) to a decimal number. For this, we will use place values. Starting from the right hand side, D is the lowest number and 4 is the highest number. So, we will multiply the lowest number with the lowest power of 16. The lowest power of 16 is 0. Then multiply the next number (F in this case) with the next highest power of 16 (which is 1). Lastly, multiply the highest number (4 in this case) with the highest power of 16 (which is 2 here). Then add all the products to find the decimal equivalent of 4FD. It comes out to be 1277.
- Remember, you must start from lowest power 0 but there’s no limit to highest power. If the Hex number has 4 digits, the highest power will be 3.
Example:
4FD = (4 x 162) + (F x 161) + (D x160)
= (4 x 256) + (15 x 16) + (13 x 1)
= 1024 + 240 + 13
= 1277
Decimal to Hex
Let’s convert the decimal number 1277 back to Hex. We will also know for sure if our conversion is correct because we know that it should be 4FD. We will use synthetic division for conversion from decimal to Hex. This means that we will continuously divide the number by 16 unless our number becomes less than 16. This process is a little complicated so we will divide it into steps.
- Divide the decimal number by 16. (1277 16 = 79.8125)
- We only want whole numbers so we will we subtract the whole part from the actual number. (79.8125 – 79 = 0.8125)
- Now multiply the decimal part with 16 to make it a whole number as well. (0.8125 x 16 = 13)
- Now again divide the number by 16. ( 79 16 = 4.9375)
- Repeat step 2 and subtract the whole part. (4.9375 – 4 = 0.9375)
- Repeat step 3 and multiply the decimal part with 16. (0.9375 x 16 = 15)
- Since 4 is less than 16. We will not divide anymore.
- Starting from the lower left side, the outer numbers are our answer. (4, 15, and 13)
- In Hex, we have 15 = F and 13 = D.
- So, 1233 in decimal is equal to 4FD in Hex.
Example
16 | 1 | 2 | 7 | 7 |
7 | 9 | - | 13 | |
0 | 4 | - | 15 | |
Hex Addition
Once, we are clear on conversions, we will move towards arithmetic operations on Hex numbers. Addition of Hex numbers is quite similar to how we do it in case of decimal numbers.
Start from right hand side, add the two numbers by adding their decimal values. (A + B= 10 + 11 =21)
Then convert the sum from decimal to hex. (21 in decimal is 15 in Hex)
If the answer has two digits, left most digit is carried to the next numbers. (5 is written in answer and 1 is carried)
Add the next two numbers and the carry. (D+ 2 + 1 = 13+ 2+ 1 = 16)
Repeat step 2. (16 in decimal is 10 in Hex. We will write 0 in answer and 1 is carried to the next numbers.)
Repeat step 4 and 2. (8 + 4 + 1 = 13, 13 in decimal is D in Hex).
Example
1 | 1 | ||
4 | 2 | A | |
+ | 8 | D | B |
D | 0 | 5 |
Hex Subtraction
Start from right hand side, subtract the decimal value of Hex number in second row from the decimal value of Hex number in first row. (A-B = 10-11)
If the number in first row is smaller than the number in second row (A<B), borrow from the next number in the first row. In hex, ‘16’ is borrowed instead of ‘1’. (4 is reduced to 3 and A is increased by 16).
Carry out the subtraction after borrowing and convert the answer to Hex. (16+A–B = 16+10-11 = 15, 15 in decimal in F in Hex)
Repeat step 1 and 2. Repeat step 3 if necessary. (3 < C so another ‘16’ is borrowed from D, 3+16–C = 3+16-12 = 7. Step 3 is not necessary because 7 in decimal is 7 in Hex too.)
Repeat step 4. (D is reduced to C since it gave ‘1’ to 3. C-8 = 12-8=4).
Example
0 | 16 | 16 | |
D | 4 | A | |
- | 8 | C | B |
4 | 7 | F |
Hex Multiplication
Multiplication in Hex is same as multiplication in decimal.
Multiply the right most digit in second row with all the digits in the first row. (C x D = 12x13 =156, 156=9C, C is written as answer and 9 is carried, (Cx2)+9 = (12x2)+9=24+9=33, 33=21, 1 is written as answer and 2 is carried)
Write a ‘0’ in the second row of answers and write your answers of the next step after this.
Multiply the next digit in second row with all the digits in first row. (A x D = 10x13 =130, 130=82, 2 is written as answer and 8 is carried, (Ax2)+8 = (10x2)+8=20+8=28, 28=1C, C is written as answer and 1 is carried)
Now we have two rows of answers from step 1 and step 3. Add the two rows to get the final row of answer. (C+0 =C, 1+2=3, 2+C=E, 0+1= 1)
Example
1 | 8 | 0 | ||
2 | 9 | 0 | ||
2 | D | |||
x | A | C | ||
0 | 2 | 1 | C | |
+ | 1 | C | 2 | 0 |
1 | E | 3 | C |
Hex Division
Long division in Hex is same as long division in decimal except that subtraction and addition is done in Hex.
Start from the left most digit in dividend (FED). Multiply the divisor (C4) with a suitable number so that the answer is less than the first two digits of the dividend. (C4 x1 = C4, C4<FE)
Subtract the product from the dividend. (F-C=15-12=3, E– 4=14-4=10 ->A)
Take the third digit of the dividend along with the difference obtained in step 2.
Repeat step 1. (C4x 4 = 196x4 =784, 784 in decimal is 310 in Hex and less than 3AD)
Repeat step 2. (3-3=0, A-1=10-1=9, D-0=D)
If the difference obtained in step 5 is less than the divisor, it is considered as the remainder. (9D is remainder)
The quotient is the number multiplied by the divisor in step 1 and 4. (14 is the quotient)
Example
1 | 4 | |||
C | 4 | F | E | D |
C | 4 | |||
3 | A | D | ||
3 | 1 | 0 | ||
0 | 9 | D |
Leave a Reply