03
HEXADECIMAL
SYSTEM
Learning Objectives
After this discussion, you must be able to:
1. Convert decimal to hexadecimal and vice
versa.
2. Convert binary to hexadecimal and vice
versa.
HEXADECIMAL SYSTEM
● This is base-16 system.
● There is an allowable digit, 0 through 9, and A through F
corresponding numbers 10 through 15. Although it may
be a bit confusing for beginners, it provides a very
convenient means of simplifying binary numbers. This
system is the most widely used by many programmers.
● Similar to octal system, conversion from binary to
hexadecimal is a matter of grouping bits. In this case, four
bits are grouped instead of three.
● To convert a binary number to hexadecimal, group the
binary digits into four bits (from the lsb to msb) and get
the equivalent in hexadecimal. 24 = (16), which the power
of 4 define the number of bit each group in hexadecimal
HEXADECIMAL SYSTEM
● Converting, for example, 1111000011112 to
hexadecimal is easy. Grouping the bits in four
produces
● 1111 0000 1111. 1111 is F, 0000 is 0, 1111 is F. Therefore,
the hex equivalent is F0F16.
Note:
A 10
1 1 1 1 0 0 0 0 1 1 1 12 B 11
8 4 2 1 8 4 2 1 8 4 2 1
C 12
15 0 15 D 13
E 14
F 0 F16 . F 15
• For converting a hexadecimal number to binary, the procedure is basically
the same.
• To convert to binary, get binary equivalent of each digit in the proper order.
2 is 102, 4 is 01002 and A is 10102.
• Always use 4 bits to represent each decimal digit.
• Therefore, 24A is 10 0100 10102.
2 4 A16
Note:
0 0 1 0 0 1 0 0 1 0 1 02 A 10
8 4 2 1 8 4 2 1 8 4 2 1 B 11
C 12
2 4 1 02 D 13
E 14
= 10 0100 10102 F 15
Decimal to Hexadecimal Conversion
(1) Convert decimal to binary 409510 =?
409510 = 212 211 210 29 28 27 26 25 24 23 22 21 20
4096 2048 1024 512 256 128 64 32 16 8 4 2 1
0 1 1 1 1 1 1 1 1 1 1 1 12
OR
4095 / 2 = 2047 r 5 (1) 7 / 2 = 3 r 5 (1)
end
2047 / 2 = 1023 r 5 (1) 3 / 2 = 1 r 5 (1)
1023 / 2 = 511 r 5 (1) 1 / 2 = 1 r 5 (1) 1111111111112
511 / 2 = 255 r 5 (1)
start
255 / 2 = 127 r 5 (1)
Note: This method use successive division by dividing 2 of the
127 / 2 = 63 r 5 (1)
given decimal then every time you divide and there is remainder
63 / 2 = 31 r 5 (1) there is equivalent 1 in binary if there is no remainder is 0. It was
31 / 2 = 15 r 5 (1) written from the last digit to first to write in binary
15 / 2 = 7 r 5 (1)
Decimal to Hexadecimal Conversion
(2) Convert decimal to binary
Then, group the binary digits into 4 bits and take the hexadecimal equivalent of each
group separately.
1111 1111 11112
F F F16 Note:
A 10
B 11
C 12
D 13
E 14
F 15
next
Hexadecimal to Decimal Conversion
ABC16 =?
A B C16
1010 1011 1100
Next,
1 0 1 0 1 0 1 1 1 1 0 02
Note:
211 210 29 28 27 26 25 24 23 22 21 20
A 10
2048 1024 512 256 128 64 32 16 8 4 2 1
B 11
2048 + 0 + 512 + 0 + 128 + 0 + 32 + 16 + 8 + 4 + 0 + 0
C 12
D 13
= 274810
E 14
F 15
Activity 5 : Convert hexadecimal to binary- decimal
7 8 D
1. 53D16 134110 0111 1000 1101 2
2. 5BD16 1469 10
0 1 1 1 1 0 0 0 1 1 0 1
3. 78D16 1933 10 211 210 29 28 2 2 2 2 2 2 21 20
7 6 5 4 3 2
2048 1024 512 256 128 64 32 16 8 4 2 1
1024+512+256+128+8+4+1
134110
Activity 6 : Convert binary to hexadecimal Note:
1. 1111111101 = 3FD16
A 10
2 0011 1110 1111 B 11
2. 1101101101 2 = 36D 16
3 E F C 12
3. 1111101111 2 = 3EF
16 D 13
3FD E 14
16
F 15