FTC disclaimer: This post contains affiliate links and I will be compensated if you make a purchase after clicking on my link.
Conversion of binary to decimal number system is an important concept to understand, which forms the basis of all computer networking and digital systems.
In networking, many struggle with the concept of IP addresses because they lack the understanding of number systems such as binary, decimal, and hexadecimal number systems.
A better understanding of the binary and decimal number system is essential for everyone interested in computer coding and networking.
Understanding the Decimal Number system
Before we move to the binary number system, understanding the decimal number system is necessary.
The decimal number system, also called the denary counting system, uses the Base-of-10 numbering system whose value range from 0 to 9.
In other words, each digit in our decimal number system can take one of the ten possible values to range from 0 to 9.
For instance, 358 base-of-10 (three hundred fifty-eight) have a value from 0 to 9, such as 3,5,8, known as digits.
The decimal number system also has the operation such as addition (+), subtraction (-), multiplication (x), and division (÷).
In the decimal number system, each digit weighting is ten times greater than the previous digit, and the weight of each digit is determined using the base 10.
Understanding the decimal weighted concept with examples.
For instance, 8 in eighty (80) has less weighing compare to 8 in eight hundred (800).
As we move from right to left in the decimal number system, the digit’s weight or magnitude will be in increasing order, and it can be written as 100,101, 102, 103, and so on.
The decimal number’s value is calculated to the sum of the digits multiplied by its respective weights.
For instance, 147399726 in a decimal format is equal to:
100000000 + 40000000 + 7000000 + 300000 + 90000 + 9000 + 700 + 20 + 6 = 147399726
To reflect the weight of each digit, it can be written as:
(1×108) + (4×107) + (7×106) + (3×105) + (9×104) + (9×103) + (7×102) + (2×101) + (6×100) = 9726
The reason behind expressing the decimal number in power notation is to understand the fundamentals of binary numbers which we will discuss later on.
MSB | Decimal number | LSB | ||||||
---|---|---|---|---|---|---|---|---|
1×108 | 4×107 | 7×106 | 3×105 | 9×104 | 9×103 | 7×102 | 2×101 | 6×100 |
100000000 | 40000000 | 7000000 | 300000 | 90000 | 9000 | 700 | 20 | 6 |
Further, the left-most digit in the decimal number system is known as the Most Significant Digit or MSD.
And the right-most digit in the decimal number system is known as the Least Significant digit or LSD.
In other words, the left-most digit of the decimal number carries more weight in comparison to the rightmost digit.
From the above example, 9 is the MSD, and 6 is the LSD of the decimal number system.
Understanding Binary Number System
The Binary number system is an essential number system for all our digital and computer systems. It follows the same rule which we have set for the decimal number system.
Unlike the decimal number system, the binary number system uses base-2 and has only two values, 0 and 1.
In digital and computer platforms, the binary values represent the logical condition, in which “1” indicates “ON” and “0” indicate “OFF.”
And, each value, either “0” and “1” is considered as “bit” in the binary number system, as we have a digit in the decimal number system.
For instance, the binary number 110011101 represents the string of “0” and “1,” The string’s weight will increase as we go from right to left.
Like the decimal number system, the rightmost bit in a binary number system is called the Least Significant Bit or LSB, and the leftmost bit is known as the Most Significant Bit or MSB.
As we have stated above, the decimal digit weight increases as we move from right to left by the factor of 10.
Similarly, in the binary number system, the weight of the bit also increases as we move from right to left by the factor of 2.
Binary to Decimal Conversion
Let’s look into the method to convert binary to decimal.
As we have stated, the binary number’s weight increases by the factor of 2 as we move from left to right.
If we take the above binary number 110011101, then the first-bit value 1 (1×20) is lower than the third bit 4 (1×22), and so on.
First, we have to calculate each bit’s weight and then multiply it with the binary number “0” and “1“. Here, we only consider the bit’s weight that has value “1” because, with “0” bit, there will be only one value “0” after multiplication.
So, the conversion of binary to decimal as below.
(110011101)2 = 1×28 + 1×27 + 0×26 + 0×25 + 1×24 + 1×23 + 1×22 + 0×21 + 1×20 = 256 + 128 + 16 + 8 + 4 + 1 = 413 = (413)10
MSB | Binary Number | LSB | |||||||
---|---|---|---|---|---|---|---|---|---|
Base-2 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
Value | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Binary | 1×28 | 1×27 | 0×26 | 0×25 | 1×24 | 1×23 | 1×22 | 0×21 | 1×20 |
Decimal | 256 | 128 | 0 | 0 | 16 | 8 | 4 | 0 | 1 |
During conversion, the “subscript” was used to indicate the base of the number system (110011101)2 = (413)10. If there would be no subscript, then it is assumed to be decimal.
Decimal to Binary Conversion
The decimal to binary conversion can be processed through any of the below methods:
- Division-by-2 method
- Subtraction with the weight of bits Method
Division-by-2 method
The division-by-2 method is one of the easiest methods to convert decimal to binary.
In this method, we first divide the given decimal number by 2 and note the remainder, either “0” or “1“.
The result part is again divided by 2, and the remainder is taken into consideration.
The process will continue until we end up with the final result “0” or “1“.
The result part in this process is also called as “Quotient.”
The first remainder we get is the Least Significant Bit or LSB, and the last result part or quotient is the Most Significant Bit or MSB.
So, the final placement of the bit will be in the order from LSB to MSB.
Decimal to binary conversion with example
For instance, let’s consider a decimal number 29410, which is converted to a binary number.
The whole process of conversion starts by dividing the decimal number 294 by 2.
The result part or quotient is 147, and the remainder is “0“. Here, “0” is the LSB because it is the first remainder.
Again, the result part is divided by 2, and the process continues until we get the final result, which is “1″ in this case.
Here, “1” is the MSB because it appears at the end.
So, the final result after the conversion of decimal number 29410 is 1001001102 in binary.
The whole process is cited below:
Decimal number 29410 | |||
Divide by 2 | |||
Result | 147 | Remainder | 0 (LSB) |
Divide by 2 | |||
Result | 73 | Remainder | 1 |
Divide by 2 | |||
Result | 36 | Remainder | 1 |
Divide by 2 | |||
Result | 18 | Remainder | 0 |
Divide by 2 | |||
Result | 9 | Remainder | 0 |
Divide by 2 | |||
Result | 4 | Remainder | 1 |
Divide by 2 | |||
Result | 2 | Remainder | 0 |
Divide by 2 | |||
Result | 1 (MSB) | Remainder | 0 |
The final result = 1001001102 |
Subtraction with the weight of bits Method
We have already discussed that weight of the binary digit increases as we move from right to left.
So, the weight of the bit in the binary number system will be 1, 2, 4, 8, 16, 32, 64, 128, 256 as we move from right to left.
28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Ninth | Eighth | Seventh | Sixth | Fifth | Fourth | Third | Second | First |
In this method, we subtract the given decimal number with the highest possible weight or the number with the largest power of two from the decimal number.
And, the place of the chosen weight is marked as “1” and the remaining part as “0.”
This process will continue until we get the final value, either “0” or “1“. The final value determines the Least Significant Bit or LSB.
Decimal to binary conversion with example
Example 1:
For instance, let’s take the decimal number 10. The highest possible weight or the number with the largest power of two would be 8 (23), subtracting from the given decimal number.
The result would be 10-8 = 2
Again, the result part will be subtracted by the highest possible weight of 2 (21) in this case.
The value would be 2-2 = 0.
23 is in the fourth position, and 21 is in the second position.
And, here the final value is “0,” which is the LSB.
So, the first and third positions would be zero (0).
The final result is 1010 = 23 + 21
Example 2:
Let’s take another example where the decimal number is 13.
The highest possible weight would be 8 (23) to be subtracted from the given decimal number.
The value would be 13-8 = 5.
The next number to be substrated will be 4 (22).
The value would be 5-4=1.
Here, 1 is the last digit, which indicates the LSB.
The final value would be 1101.
So, you have to remember only the weight of each bit in its position from left to right. This will help you to position “1” or “0” in a binary number.
How to quickly convert decimal to binary or vice versa?
To quickly convert decimal to binary or vice versa, use the “Programmer” calculator in Windows 10.
Here, firstly, you have to choose the number system which you want to convert.
They have listed Binary, Decimal, Octal, and Hexadecimal as BIN, DEC, OCT, HEX.
Here, we have chosen binary number and type in 0001 0101. The decimal value, as a result, is 21.
Binary Number in a Group
The binary number can be combined to form a group, and each group is defined with the term.
The basic form of binary number groups is – a Bit, a Nibble, a Byte, and a Word.
A Bit represents only one binary digit, a Nibble represents a group of 4 binary digits, a Byte represents a group of 8 binary digits, and a Word represents a group of 16 binary digits.
The most common names of larger groups of binary digits are:
Number of Binary Digits | Group name |
---|---|
1 | Bit |
4 | Nibble |
8 | Byte |
16 | Word |
32 | Double Word |
64 | Quad Word |
Difference between byte, kilobyte, megabyte, and gigabyte
The Byte is used by most computer hardware to measure storage capacities such as hard drives and memory.
For better understanding, you can always refer to the bits and byte concept.
The size of the storage is generally expressed in Megabytes or Gigabytes.
Let’s understand the relation between bytes, kilobyte, megabyte, and gigabyte.
Number of Bytes | Common Name |
---|---|
1,024 (210) | kilobyte (kb) |
1,048,576 (220) | Megabyte (Mb) |
1,073,741,824 (230) | Gigabyte (Gb) |
Long number! (240) | Terabyte (Tb) |
Number of kilobytes | Common Name |
---|---|
1,024 kb | 1 Mb |
1,048,576 kb | 1 Gb |
1,073,741,824 kb | 1 Tb |
Number of Megabytes | Common name |
---|---|
1,024 Mb | 1 Gb |
1,048,576 Mb | 1 Tb |
Number of Gigabytes | Common name |
---|---|
1,024 Gb | 1 Tb |
Summary
A binary number system is of base-2, and the decimal number system is of base-10. The binary number has only two logic values, “0” and “1“.
Whereas, the decimal number system value ranges from 0 to 9.
A binary number is a weighted number whose weight increases with 2 to the power 0,1,2…so on as we move from right to left.
In other words, the weight of the binary digit gets double as we move from right to left.
Moreover, the decimal conversion to binary number can be accomplished with two methods: The division-by-2 method and subtracting number with the largest power-of-2 method.