0% found this document useful (0 votes)
333 views11 pages

Binary To Hexadecimal

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
333 views11 pages

Binary To Hexadecimal

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

5.

Conversion Binary to Hexadecimal

ASCII Decimal Hexadecimal Octal Binary


null 0 0 0 0
start of header 1 1 1 1
start of text 2 2 2 10
end of text 3 3 3 11
end of transmission 4 4 4 100
enquire 5 5 5 101
acknowledge 6 6 6 110
bell 7 7 7 111
backspace 8 8 10 1000
horizontal tab 9 9 11 1001
linefeed 10 A 12 1010
vertical tab 11 B 13 1011
form feed 12 C 14 1100
carriage return 13 D 15 1101
shift out 14 E 16 1110
shift in 15 F 17 1111
data link escape 16 10 20 10000
device control 1/Xon 17 11 21 10001
device control 2 18 12 22 10010
device control 3/Xoff 19 13 23 10011
device control 4 20 14 24 10100
negative acknowledge 21 15 25 10101
synchronous idle 22 16 26 10110
end of transmission block 23 17 27 10111
cancel 24 18 30 11000
end of medium 25 19 31 11001
end of file/ substitute 26 1A 32 11010
escape 27 1B 33 11011
file separator 28 1C 34 11100
group separator 29 1D 35 11101
record separator 30 1E 36 11110
unit separator 31 1F 37 11111
space 32 20 40 100000
! 33 21 41 100001
" 34 22 42 100010
# 35 23 43 100011
$ 36 24 44 100100
% 37 25 45 100101
& 38 26 46 100110
' 39 27 47 100111
( 40 28 50 101000
) 41 29 51 101001
* 42 2A 52 101010
+ 43 2B 53 101011
, 44 2C 54 101100
- 45 2D 55 101101
. 46 2E 56 101110
/ 47 2F 57 101111
0 48 30 60 110000
1 49 31 61 110001
2 50 32 62 110010
3 51 33 63 110011
ASCII Decimal Hexadecimal Octal Binary
4 52 34 64 110100
5 53 35 65 110101
6 54 36 66 110110
7 55 37 67 110111
8 56 38 70 111000
9 57 39 71 111001
: 58 3A 72 111010
; 59 3B 73 111011
< 60 3C 74 111100
= 61 3D 75 111101
> 62 3E 76 111110
? 63 3F 77 111111
@ 64 40 100 1000000
A 65 41 101 1000001
B 66 42 102 1000010
C 67 43 103 1000011
D 68 44 104 1000100
E 69 45 105 1000101
F 70 46 106 1000110
G 71 47 107 1000111
H 72 48 110 1001000
I 73 49 111 1001001
J 74 4A 112 1001010
K 75 4B 113 1001011
L 76 4C 114 1001100
M 77 4D 115 1001101
N 78 4E 116 1001110
O 79 4F 117 1001111
P 80 50 120 1010000
Q 81 51 121 1010001
R 82 52 122 1010010
S 83 53 123 1010011
T 84 54 124 1010100
U 85 55 125 1010101
V 86 56 126 1010110
W 87 57 127 1010111
X 88 58 130 1011000
Y 89 59 131 1011001
Z 90 5A 132 1011010
[ 91 5B 133 1011011
\ 92 5C 134 1011100
] 93 5D 135 1011101
^ 94 5E 136 1011110
_ 95 5F 137 1011111
` 96 60 140 1100000
a 97 61 141 1100001
b 98 62 142 1100010
c 99 63 143 1100011
d 100 64 144 1100100
e 101 65 145 1100101
f 102 66 146 1100110
g 103 67 147 1100111
h 104 68 150 1101000
i 105 69 151 1101001
j 106 6A 152 1101010
ASCII Decimal Hexadecimal Octal Binary
k 107 6B 153 1101011
l 108 6C 154 1101100
m 109 6D 155 1101101
n 110 6E 156 1101110
o 111 6F 157 1101111
p 112 70 160 1110000
q 113 71 161 1110001
r 114 72 162 1110010
s 115 73 163 1110011
t 116 74 164 1110100
u 117 75 165 1110101
v 118 76 166 1110110
w 119 77 167 1110111
x 120 78 170 1111000
y 121 79 171 1111001
z 122 7A 172 1111010
{ 123 7B 173 1111011
| 124 7C 174 1111100
} 125 7D 175 1111101
~ 126 7E 176 1111110
DEL 127 7F 177 1111111
Conversions between ASCII, decimal, hexadecimal, octal, and binary values

Number Systems are a major part of mathematics. The binary number system is a system in
which numbers are expressed in the base 2. Conversion of binary to the hexadecimal number
system. The binary-to-decimal conversion is very easy and is explained further.
Decimal Binary

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001
Decimal Binary

10 1010

The hexadecimal number system is a system in which numbers are expressed in the base 16. In
the hexadecimal number system, the numbers are represented in terms of 0-9 and A – F. The
hexadecimal number is written as number H, (number)16, (number)H. Example: (A23F)16,
Decimal Hexadecimal

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 8

9 9

10 A

11

Conversion of Binary to Hexadecimal


Method 1
Convert Binary to Hexadecimal without Conversion Table
1. Firstly, convert the given binary number into decimal.
2. Then, convert the obtained decimal into hexadecimal.

Example 1: (1110)2 = (_______)16


First convert (1110)2 into decimal = (1110)2 = 23 × 1 + 22 × 1 + 21 × 1 + 20 × 0 = 8 + 4 + 2 + 0 = (14)10
Then, convert (14)10 into hexadecimal = (14)10 = (E)16
Example 2 Convert binary number 1101010 into hexadecimal number.
First convert this into decimal number:
= (1101010)2
= 1x26+1x25+0x24+1x23+0x22+1x21+0x20
= 64+32+0+8+0+2+0
= (106)10
Then, convert it into hexadecimal number
= (106)10
= 6x161+10x160
= (6A)16 which is answer.

Method 2
Convert Binary to Hexadecimal with Conversion Table or using grouping
Using conversion tables for converting binary to hexadecimal numbers is considered to be one of the
easiest methods. As hexadecimal numbers are also positional number systems and binary numbers
only include the digits 0 and 1, every four bits are equal to one hexadecimal number, which also
includes the letters A to F.
The conversion table used in given as:
Hexa 0 1 2 3 4 5 6 7

Binary 0000 0001 0010 0011 0100 0101 0110 0111

Hexa 8 9 A B C D E F

Binary 1000 1001 1010 1011 1100 1101 1110 1111

Example-1 − Convert binary number 1010101101001 into hexadecimal number. Since there is
no binary point here and no fractional part. So,
Therefore, Binary to hexadecimal is,

= (1010101101001)2
= (1 0101 0110 1001)2
= (0001 0101 0110 1001)2
= (1 5 6 9)16
= (1569)16

Example-2 −Convert binary number 001100101.110111


into hexadecimal number. Since there is binary point here and fractional part. So,
Therefore, Binary to hexadecimal is,
= (001100101.110111)2
= (0 0110 0101 . 1101 1100)2
= (0110 0101 . 1101 1100)2
= (6 5 . D C)16
= (65.DC)16
These are above simple conversions binary number to hexadecimal number.

6. Conversion Hexadecimal to Binary


Method 1 :- With Conversion table
This method is a direct procedure by just looking at the conversation table we can convert
hexadecimal to binary. The steps are fairly simple, lets look at them:
 Step 1: Write the hexadecimal
 Step 2: Find the equivalent decimal of each of the digits by looking at the conversion table.
 Step 2: Once the decimal number is obtained, looking at the same table we can convert it
to a binary.
 Step 3: Combine all the binary numbers together to obtain the final binary number.

Example Input: Hexadecimal = 1AC5


Output: Binary = 0001101011000101
Explanation:
Equivalent binary value of 1: 0001
Equivalent binary value of A: 1010
Equivalent binary value of C: 1100
Equivalent binary value of 5: 0101
Input: Hexadecimal = 5D1F
Output: Binary = 0101110100011111

Method 2:- This method requires both multiplication and division of numbers using the respective
base numbers. The hexadecimal base number is 16, the base number of a decimal number is 10, and
the base of a binary number is 2. Let us look at the steps:

 Step 1: Write the hexadecimal number and find its equivalent decimal number.
 Step 2: To find the decimal equivalent, we multiply each digit with 16 n-1, where the digit is in its
nth position.
 Step 3: After multiplying the numbers, add the product of those numbers to obtain the decimal
number.
 Step 4: To convert decimal to binary, we divide the decimal number by 2 by keeping the
remainder aside and dividing the quotient by 2 until we arrive at zero.
 Step 5: Once the quotient is zero, we arrange the remainder from bottom to top i.e. reverse order
to obtain the binary number.

Convert A2B16 to an equivalent binary number without conversion table

Solution: Given hexadecimal number = A2B16


First, convert the given hexadecimal to the equivalent decimal number.
A2B16 = (A × 162) + (2 × 161) + (B × 160)
= (A × 256) + (2 × 16) + (B × 1)
= (10 ×256) + 32 + 11
= 2560 + 43
= 260310
Now we have to convert 260310 to binary (Same by Division method)
The binary number obtained is 1010001010112
Hence, A2B16 = 1010001010112

Question 2: Convert E16 to an equivalent binary number.


Solution: Given, a hexadecimal number is E.
First, convert the given hexadecimal to the equivalent decimal number.
E16 = E × 160
=E×1
=E
=1410
Now we have to convert 1410 to binary number.
The binary number obtained is 11102
Hence, E16 = 11102

Question 3: Convert 3016 to an equivalent binary number.


Solution: Given the hexadecimal number is 30
First, convert the given hexadecimal to the equivalent decimal number.
3016 = (3 × 161) + (0 × 160)
= 48 + 0
= 48(Decimal number)
Now we have to convert 4810 to binary.
Therefore,
The binary number is 1100002
Hence, 3016 = 1100002
7. Conversion Octal to decimal
Octal Number System is a number system with base 8 as it uses eight symbols (or
digits) namely 0, 1, 2, 3, 4, 5, 6, and 7. For example, 228, 138, 178, etc. are octal
numbers.
To convert an octal number to a decimal number, you can use the following steps:
Steps to Convert Octal Number to Decimal Number
 Step 1: Write the octal number.
 Step 2: Multiply each digit of the given octal number with an increasing power of 8
starting from the rightmost digit.
 Step 3: Sum all the products obtained in step 2.
Here are some examples of octal to decimal conversions:
Example 1: Represent 1238 as a Decimal Number.
Solution:
1238 = 1 × 82 + 2 × 81 + 3 × 80
⇒ 1238 = 1 × 64 + 2 × 8 + 3 × 1
⇒ 1238 = 64 + 16 + 3
⇒ 1238 = 8310
Hence 8310 is decimal representation of 1238.
Example 2:-
 (2671)8: 2 × 8 + 6 × 8 + 7 × 8 + 1 × 8 = 1465, so (2671)8 = (1465)10
 (761.12)8: 7 × 8 + 6 × 8 + 1 × 8 + 1 × 8 + 2 × 8 = 497.15625, so (761.12)8 = (497.15625)10
 (121)8: 1 x 8 + 2 x 8 + 1 x 8 = 64 + 16 + 1, so (121)8 = (101)10

Example 3: Convert Octal number 2671 to a Decimal number.


Solution:
(2671)8(2671)8 = 2 × 83 + 6 × 82 + 7 × 81 + 1 × 80
(2671)8(2671)8 = 2 × 512 + 6 × 64 + 7 × 8 + 1 × 1
(2671)8(2671)8 = 1024 + 384 + 56 + 1
(2671)8(2671)8 = 1465
Therefore, (2671)8(2671)8 = (1465)10(1465)10.

Example 4: Convert Octal number 761.12 to a Decimal number.


Solution:
(761.12)8 = 7 × 82 + 6 × 81 + 1 × 80 + 1 × 8-1 + 2 × 8-2
(761.12)8= 7 × 64 + 6 × 8 + 1 × 1 + 1 × 1/8 + 2 × 1/82
(761.12)8 = 448 + 48 + 1 + 0.125 + 0.03125
(761.12)8 = 497.15625
Therefore, (761.12)8 = (497.15625)10

Example 5: Convert octal number (121)8(121)8 to its decimal form.


Solution:
(121)8= 1 x 82 + 2 x 81 + 1 x 80
(121)8 = 1 x 64 + 2 x 8 + 1 x 1
(121)8 = 64 + 16 + 1
Therefore, (121)8 = (81)10

8. Conversion Decimal to Octal


For converting Decimal numbers into Octal numbers, use different methods such as formula,
division method, and so on. Here, use the remainder formula. Steps to convert decimal number
to Octal number using decimal to the Octal formula are as follow,
1. Write the given decimal number
2. If the given decimal number is less than 8 the octal number is the same.
3. If the decimal number is greater than 7 then divide the number by 8.
4. Note the remainder, we get after division
5. Repeat step 3 and 4 with the quotient till it is less than 8
6. Now, write the remainders in reverse order (bottom to top)
7. The resultant is the equivalent octal number to the given decimal number.
Example 1: Convert (127)10 to Octal.
Solution: Divide 127 by 8
127 ÷ 8= 15(Quotient) and (7)Remainder
Divide 15 by 8 again.
15 ÷ 8 = 1(Quotient) and (7) Remainder
Divide 1 by 8, we get;
1 ÷ 8 = 0(Quotient) and (1) Remainder
Since the quotient is zero now, no more division can be done. So by taking the remainders in reverse
order, we get the equivalent octal number.
Hence, (127)10 = (177)8

Example 2: Convert 5210 to octal.


Solution: Divide 52 by 8
52 ÷ 8 = 6(Quotient) and (4)Remainder
Divide 6 by 8 again.
6 ÷ 8 = 0(Quotient) and (6) Remainder
Since the quotient is zero now, no more division can be done. So by taking the remainders in
reverse order, we get the equivalent octal number.
Hence, (52)10 = (64)8

Example 3: Convert 10010 to octal.


Solution: Divide 100 by 8
100 ÷ 8= 12(Quotient) and (4)Remainder
Divide 12 by 8 again.
12 ÷ 8 = 1(Quotient) and (4) Remainder
Divide 1 by 8, we get;
1 ÷ 8 = 0(Quotient) and (1) Remainder
Since the quotient is zero now, no more division can be done. So by taking the remainders in
reverse order, we get the equivalent octal number.
Hence, (100)10 = (144)8

Method 1: Convert Decimal to Octal with Steps:


1. Divide the decimal number by 8.
2. Record the remainder.
3. Update the quotient (the result of the division).
4. Repeat the process with the new quotient until the quotient becomes zero.
5. Read the remainder in reverse order to get the octal number.
Example 1
Let's convert the decimal number 156 to octal:
1. Divide the decimal number (156) by 8:
 156 ÷ 8 = 19 with a remainder of 4.
 Record the remainder: 4.
2. Divide the quotient (19) by 8:
 19 ÷ 8 = 2 with a remainder of 3.
 Record the remainder: 3.
3. Divide the new quotient (2) by 8:
 2 ÷ 8 = 0 with a remainder of 2.
 Record the remainder: 2.
4. Reading the remainders in reverse order (from the last division to the first):
 The remainder are 2, 3, and 4.
 Therefore, the octal representation of 156 is 234.
Example 2
Convert the decimal number 83 to octal:
1. Divide 83 by 8:
 83 ÷ 8 = 10 with a remainder of 3.
 Record the remainder: 3.
2. Divide the quotient (10) by 8:
 10 ÷ 8 = 1 with a remainder of 2.
 Record the remainder: 2.
3. Divide the new quotient (1) by 8:
 1 ÷ 8 = 0 with a remainder of 1.
 Record the remainder: 1.
4. Reading the remainder in reverse order:
 The remainder are 1, 2, and 3.
 Therefore, the octal representation of 83 is 123.
Example 3
Try converting the decimal number 45 to octal using the steps provided:
1. Divide 45 by 8:
 45 ÷ 8 = 5 with a remainder of 5.
 Record the remainder: 5.
2. Divide the quotient (5) by 8:
 5 ÷ 8 = 0 with a remainder of 5.
 Record the remainder: 5.
3. Reading the remainder in reverse order:
 The remainder are 5 and 5.
 Therefore, the octal representation of 45 is 55.
Following these steps, you can accurately convert any decimal number to its octal equivalent.
Method 2: Convert Decimal to Binary to Octal
This method involves converting a decimal number to binary first and then converting the binary
number to octal.
Steps to Convert Decimal to Binary:
1. Divide the decimal number by 2.
2. Record the remainder.
3. Update the quotient.
4. Repeat the process until the quotient becomes zero.
5. Read the remainder in reverse order to get the binary number.
Convert Binary to Octal:
1. Group the binary digits into sets of three, starting from the right. Add leading zeros if
necessary.
2. Convert each group of three binary digits to a single octal digit.
Example 1
Convert decimal 156 to octal:
1. Convert 156 to binary:
 156 ÷ 2 = 78, remainder = 0
 78 ÷ 2 = 39, remainder = 0
 39 ÷ 2 = 19, remainder = 1
 19 ÷ 2 = 9, remainder = 1
 9 ÷ 2 = 4, remainder = 1
 4 ÷ 2 = 2, remainder = 0
 2 ÷ 2 = 1, remainder = 0
 1 ÷ 2 = 0, remainder = 1
2. Binary representation: 10011100.
3. Group the binary digits into sets of three (from right to left): 10011100.
4. Add leading zeros if necessary: 001 001 110
5. Convert each group of three binary digits to octal:
 001 = 1
 001 = 1
 110 = 6
6. So, the octal representation is 116.

You might also like