Convert Binary to Decimal and Decimal to Binary Numbers
Table of Contents
Convert Binary to Decimal Numbers
A tutorial on how to convert decimal to binary and binary to decimal numbers with full explanations, exercises and answers.
The digits 0, 1, … 9 are to write any number in the decimal system. Likewise, we use 0 and 1 to write numbers in the binary number system.
In decimal number system which is also called the base-10 system
, the decimal number 149 is written as follows:
149 = 1*102 + 4*101 + 9*100
The binary or base-2 number 1 0 0 1 0 1 0 1
can be converted to a decimal number as follows:
1*27 + 0*26 + 0*25 + 1*24 + 0*23 + 1*22 + 0*21 + 1*20
= 128 + 16 + 4 + 1
= 149
The binary number 1 0 0 1 0 1 0 1 is written as 149 in the decimal system.
Convert Decimal Numbers to Binary
To convert a decimal number into a binary number, we carry out successive divisions by 2 and use the reminders of the successive divisions.
Example: Convert the decimal number 123 to a binary number.
123 ÷ 2 = 61 , reminder = 1 , least significant bit, goes to the right.
61 ÷ 2 = 30 , reminder = 1
30 ÷ 2 = 15 , reminder = 0
15 ÷ 2 = 7 , reminder = 1
7 ÷ 2 = 3 , reminder = 1
3 ÷ 2 = 1 , reminder = 1
1 ÷ 2 = 0 , reminder = 1 , Most significant bit, goes to the left.
The decimal number 123 in written as 1 1 1 1 0 1 1 in binary.
We can easily check by converting 1 1 1 1 0 1 1 into decimal as follows:
1*26 + 1*25 + 1*24 + 1*23 + 0*22 + 1*21 + 1*20 = 64 + 32 + 16 + 8 + 2 + 1 = 123
A
Decimal to Binary Converter that may be used to convert decimal numbers to binary form.
Exercises with Answers
A - Convert the binary numbers into decimal numbers
- 11
- 101
- 1111
- 110111011
- 1111100011110011
B - Convert the decimal numbers into binary numbers
- 7
- 13
- 128
- 1678
- 12359
Answers to Above Exercises
A - Convert the binary numbers into decimal numbers
- 11 = 1*21 + 1*20 = 2 + 1 = 3
- 101 = 1*22 + 0*21 + 1*20
= 4 + 1
= 5
- 1111 = 1*23 + 1*22 + 1*21 + 1*20
= 8 + 4 + 2 + 1
= 15
- 110111011 = 1*28 + 1*27 + 0*26 + 1*25 + 1*24 + 1*23 + 0*22 + 1*21 + 1*20
= 256 + 128 + 32 + 16 + 8 + 2 + 1
= 443
- 1111100011110011 = 1*215 + 1*214 + 1*213 + 1*212 + 1*211 + 0*210 + 0*29 + 0*28 + 1*27 + 1*26 + 1*25 + 1*24 + 0*23 + 0*22 + 1*21 + 1*20
= 32768 + 16384 + 8192 + 4096 + 2048 + 128 + 64 + 32 + 16 + 2 + 1
= 63731
B - Convert the decimal numbers into binary numbers
In what follows r means the reminder of the division.
-
7 ÷ 2 = 3 , r = 1
3 ÷ 2 = 1 , r = 1
1 ÷ 2 = 0 , r = 1
Hence 7 in binary is written as 111
-
13 ÷ 2 = 6 , r = 1
6 ÷ 2 = 3 , r = 0
3 ÷ 2 = 1 , r = 1
1 ÷ 2 = 0 , r = 1
Hence 13 in binary is written as 1101
-
128 ÷ 2 = 64 , r = 0
64 ÷ 2 = 32 , r = 0
32 ÷ 2 = 16 , r = 0
16 ÷ 2 = 8 , r = 0
8 ÷ 2 = 4 , r = 0
4 ÷ 2 = 2 , r = 0
2 ÷ 2 = 1 , r = 0
1 ÷ 2 = 0 , r = 1
Hence 128 in binary is written as 10000000
-
1678 ÷ 2 = 839 , r = 0
839 ÷ 2 = 419 , r = 1
419 ÷ 2 = 209 , r = 1
209 ÷ 2 = 104 , r = 1
104 ÷ 2 = 52 , r = 0
52 ÷ 2 = 26 , r = 0
26 ÷ 2 = 13 , r = 0
13 ÷ 2 = 6 , r = 1
6 ÷ 2 = 3 , r = 0
3 ÷ 2 = 1 , r = 1
1 ÷ 2 = 0 , r = 1
Hence 1678 in binary is written as 11010001110
-
12359 ÷ 2 = 6179 , r = 1
6179 ÷ 2 = 3089 , r = 1
3089 ÷ 2 = 1544 , r = 1
1544 ÷ 2 = 772 , r = 0
772 ÷ 2 = 386 , r = 0
386 ÷ 2 = 193 , r = 0
193 ÷ 2 = 96 , r = 1
96 ÷ 2 = 48 , r = 0
48 ÷ 2 = 24 , r = 0
24 ÷ 2 = 12 , r = 0
12 ÷ 2 = 6 , r = 0
6 ÷ 2 = 3 , r = 0
3 ÷ 2 = 1 , r = 1
1 ÷ 2 = 0 , r = 1
Hence 12359 in binary form is written as follows 11000001000111