How to Convert Decimal to Binary?
To convert numbers from decimal to binary, the given decimal number is divided repeatedly by
2 and the remainders are noted down till we get 0 as the final quotient. The following steps is
considered as the decimal to binary formula that shows the procedure of conversion.
Step 1: Divide the given decimal number by 2 and note down the remainder.
Step 2: Now, divide the obtained quotient by 2, and note the remainder again.
Step 3: Repeat the above steps until you get 0 as the quotient.
Step 4: Now, write the remainders in such a way that the last remainder is written first,
followed by the rest in the reverse order.
Step 5: This can also be understood in another way which states that the Least Significant
Bit (LSB) of the binary number is at the top and the Most Significant Bit (MSB) is at the
bottom. This number is the binary value of the given decimal number.
Let us understand this with an example.
Example: Convert the decimal number 1310 to binary.
Solution: We will start dividing the given number (13) repeatedly by 2 until we get the quotient
as 0. We will note the remainders in order.
1|Page
Division by 2 Quotient Remainder
13 ÷ 2 6 1 (LSB)
6÷2 3 0
3÷2 1 1
1÷2 0 1 (MSB)
After noting the remainders, we will write them in such a way that the Most Significant Bit (MSB)
of the binary number is written first, followed by the rest. Therefore, the binary equivalent for the
given decimal number 1310 is 11012. This means that 1310 = 11012.
Example 2: Convert the following decimal number into binary number: 156
Solution: To convert 15610 to the binary number system, let us divide it repeatedly by 2 and note
the remainders as shown below.
2|Page
Division by 2 Quotient Remainder
156 ÷ 2 78 0 (LSB)
78 ÷ 2 39 0
39 ÷ 2 19 1
19 ÷ 2 9 1
9÷2 4 1
4÷2 2 0
2÷2 1 0
1÷2 0 1 (MSB)
Let us write the remainders in the reverse order. Hence, the binary equivalent for the given
decimal number 15610 is 100111002.
Decimal to Binary Table
There are different methods of converting numbers from decimal to binary. When we convert
numbers from decimal to binary, the base of the number changes from 10 to 2. It should be
noted that all decimal numbers have their equivalent binary numbers. The following table shows
the decimal to binary chart of the first 20 whole numbers.
3|Page
Decimal Numbers Binary Numbers
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
16 10000
17 10001
18 10010
4 |19
Page 10011
20 10100
Example 1: Using decimal to binary formula, convert 29 decimals into a binary number.
Answer: Hence, 29 as binary is 111012111012.
Example 2: Convert 145 decimal into a binary number.
Answer: Hence, 145 decimals as binary is 100100012100100012.
How to Convert Binary to Decimal?
You just have to follow the below steps to convert binary numbers to their decimal equivalent.
Step 1: Write the binary number and count the powers of 2 from right to left (starting from 0).
Step 2: Write each binary digit (right to left) with corresponding powers of 2 from right to left,
such that MSB or the first binary digit will be multiplied by the greatest power of 2.
Step 3: Add all the products in the step 2
Step 4: The answer is our decimal number.
This can be better explained using the below examples
Binary to Decimal Conversion
Binary to Decimal conversion is achieved using the two steps that are,
Positional Notation Method
Doubling Method
Now let’s learn about them in detail.
Method 1: Using Positions
Binary to Decimal Conversion can be achieved using the example added below.
Example 1: Let’s consider a binary number 1111. We need to convert this binary number
to a decimal number.
As mentioned in the above paragraph while converting from binary to decimal we need to
consider each digit in binary number from right to left.
5|Page
By this way, we can do binary to decimal conversion.
Note: We represent any binary number with this format (xxxx)2 and decimal in (xxxx)10 format.
Example 2: Convert (101010)2 = (?)10
We keep on increasing the power of 2 as long as number of digits in binary number increases.
Example 3: Convert (11100)2 = (?)10
6|Page
Resultant Decimal number = 0+0+4+8+16 = 28
So (11100)2 = (28)10
Method 2: Doubling Method
To explain this method, we will consider an example and try to solve that stepwise.
Example 1: Convert Binary number (10001)2 to decimal.
Similar to the above approach, In this approach also consider each digit but from left to right
and performs step-wise computations on it.
1 0 0 0 1
Step-1 First we need to multiply 0 with 2 and add the 1st digit in binary number.
0x2+1=0+1=1
Step-2 Now use the result of above step and multiply with 2 and add the second digit of binary
number.
1 0 0 0 1
1x2+0=2+0=2
7|Page
The same step 2 is repeated until there will be no digit left. The final result will be the resultant
decimal number.
0 0 0 1
1
2x2+0=4+0=4
0 0 0 1
1
4x2+0=8+0=8
1 0 0 0 1
8 x 2 + 1 = 16 + 1 = 17
So we performed step 2 on all remaining numbers and finally, we left with result 17 which is a
decimal number for the given binary number.
So (10001)2 = (17)10
Example 2: Convert (111)2 to decimal using doubling approach.
1 1 1
0x2+1=0+1=1
1 1
1
8|Page
1x2+1=2+1=3
1 1 1
3x2+1=6+1=7
The final result is 7 which is a Decimal number for 111 binary numeral system. So (111)2 =
(7)10
These are the 2 approaches that can be used or applied to convert binary to decimal.
Hex to Decimal Conversion
Hex to Decimal Conversion is a fundamental operation in computer science and digital
electronics. The operation requires converting numerals from one number system to
another, specifically from the Hexadecimal Number System to the Decimal Number
System. As we know, a number system is used to represent and categorize numbers based on
their base numbers, which is a fundamental concept in mathematics.
The hexadecimal system or simply known as ” Hex”, which uses a base of 16, is often
employed in programming, memory addressing, and color coding due to its compact
representation of binary data. Hexadecimal employs sixteen different symbols as opposed to
the decimal system’s ten, which are “0” through “9” for 0 to 9 and “A” through “F” for ten
to fifteen.
When converting from hexadecimal to decimal, it is important to keep consideration for both
number system’s base.
This article provides a well-rounded description of the Hexadecimal Number System, the
Decimal Number System, and how to convert hexadecimal numerals into decimal numerals.
What is Hexadecimal Number System?
The hexadecimal number system, commonly known as base-16 or just hex, is a system of
numbers that employs 16 different symbols for representing various values. There are only 16
symbols used for denoting hexadecimal integers. A, B, C, D, E, and F are the following values
or symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
9|Page
A decimal value is represented by each digit. D, for instance, is equal to base-10 number 13.
This table, which lists the 16 hexadecimal digits and their decimal, octal, and binary equivalents,
will be useful for converting between number systems. The following list is additionally useful as
a converter or translator.
Numerals in Hexadecimal Number System
This number system uses 16 different symbols.
Numeral 0 1 2 3 4 5 6 7 8 9 A B C D E F
Used
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
For
Example of Hexadecimal Numbers
As hexadecimal is a number system, all numbers in decimal and other number systems can
also be represented in the hexadecimal number system. The following table represents some
numbers in hexadecimal, decimal, octal, and binary as well.
Example 1: Covert 1A3 into decimal numbers.
Solution:
Start from the rightmost digit i.e., 3. Its position is 0.
Decimal Value = 3 × 160 = 3 × 1 = 3
Move to the next digit i.e., A with a position of 1.
Since A represents 10 in decimal, the calculation becomes:
Decimal Value = 10 × 161 = 10 × 16 = 160
Finally, move to the leftmost digit i.e., 1 with a position of 2.
Decimal Value = 1 × 162 = 1 × 256 = 256
Thus, Decimal Value of 1A3 = 3 + 160 + 256 = 419
10 | P a g e
So, the hexadecimal number “1A3” is equivalent to the decimal number 419.
Example 2: Convert 6CF (hex) to decimal
Solution:
6CF is the given hexadecimal number. In hexadecimal number system
6=6
C = 12
F = 15
Start at the unit’s place of the number and multiply each digit by a power of 16 in order to
convert this to a decimal number system.
6CF= (6 × 162) + (12× 161) + (15 × 160)
⇒ 6CF= (6 × 256 + 12 × 16 + 15 × 1)
⇒ 6CF= 1536 + 192 + 15
⇒ 6CF= 1743
Thus, decimal value of 6CF is 1743.
Problems/Exercises
1. Convert (4C7) to a decimal number.
Solution:
In Hexadecimal Number System,
4= 4, C = 12, and 7 = 7
Hence, (4C7)16 = (4× 16²) + (12 × 16¹) + (7 × 16⁰)
⇒ (4C7)16 = (4 × 256) + (12 × 16) + (7 × 1)
⇒ (4C7)16 = 1024 + 192 + 7
⇒ (4C7)16 = 1223
11 | P a g e
Therefore, (2C7)16 = (1223)10
2. Convert (16F) into its equivalent Decimal number.
Solution:
We have a hexadecimal number 16F that we want to convert into a decimal number.
We know that 1 = 1, 6 = 6 and F = 16.
Therefore (16F)16 = (1 × 162) + (6 × 161) + (16 × 160)
⇒ (16F)16 = (1 × 256) + (6 × 16) + (16 × 1)
⇒ (16F)16 = 256 + 96 + 16
⇒ (16F)16 = (368)10
Hence, (16F)16 to decimal is 368.
3. Convert 5BC (hex) to decimal.
Solution:
We know that 5 = 5, B = 11 and C = 12.
Therefore (5BC)16 = (5 × 162) + (11 × 161) + (12 × 160)
⇒ (5BC)16 = (5 × 256) + (11 × 16) + (12 × 1)
⇒ (5BC)16 = 1280+176+12
⇒ (5BC)16 = (1468)10
Hence, (5BC)16 is 1468 in decimal number system.
4. Convert 31.D216.
Solution
As we know,
Digit 3 1 D 2
Place
161 160 16-1 16-2
value
12 | P a g e
31.D216 = (3×161) + (1×160) + (D×16-1) + (2×16-2)
⇒ 31.D216 = 48 + 1 + 13×16-1 + 2×16-2
⇒ 31.D216 = 48 + 1 + 0.8125 + 0.0078125
⇒ 31.D216 = 49.8203125
Decimal to Hexadecimal Conversion
Example 1: Convert 20 in decimal to hexadecimal
Solution:
We know that to convert a number from decimal to hexadecimal we need to divide the number
by 16 and then successively divide the quotient by 16 until quotient is zero
20 ÷ 16 gives Q1 = 1, R1 = 4
1 ÷ 16 gives Q2 = 0, R2 = 1
Hence, 20 in decimal is equal to 14 in hexadecimal
Example 2: Convert (678)10 to Hexadecimal
Solution:
678 ÷ 16 gives Q1 = 42, R1 = 6
42 ÷ 16 gives Q2 = 2, R2 = 10 = A
2 ÷ 16 gives Q3 = 0, R3 = 2
Hence, (678)10 = 2A6 in Hexadecimal
Example 3: Convert (1429)10 into Hexadecimal
Solution:
1429 ÷ 16 gives Q1 = 89 and R1 = 5
89 ÷ 16 gives Q2 = 5 and R2 = 9
5 ÷ 16 gives Q3 = 0 and R3 = 5
Hence (1429)10 = 595 in Hexadecimal
13 | P a g e
Example 4: Convert 0.125 in Hexadecimal
Solution:
To convert a fractional number we multiply the fractional part by 16 and then again multiply the
fractional part of the product by 16 till the number becomes zero and then write the result from
the first product and not from the last as we do normally.
0.125 ⨯ 16 = 2.0
0 ⨯ 16 = 0
Hence, (.125)10 = 0.2
Practice Questions on Decimal to Hexadecimal Conversion
Q1: 234
Q2: 4573
Q3: 0.1345
Q4: 675434
Q5: 567
14 | P a g e