# Binary to Decimal and Decimal to Binary Conversion

The roots of the Binary number system lies in Chinese literature. The modern binary system was invented by Gottfried Leibniz in 1689. His theology was based on the Christian idea of ‘ Creation out of nothing’. He was trying to find a system that could convert the logic’s verbal statements into mathematical ones. In the classic Chinese text ” Book of Changes”, he found a binary code that confirmed his theory that life can be reduced down to a series of straightforward proportions. He then created a system that can represent the information in the form of rows of zero’s and ones. Usage of the binary system can be found in ancient text before the 16th Century. Before 1450, a Hybrid binary- decimal system was used by the residents of island Mangareva in French Polynesia. Binary-Decimal conversions are described in this article.

## What is a Binary Number System?

The usage of binary numbers can be found in the texts of ancient cultures like Egypt, China, and India. In this system, text, data, and numbers are represented as a base-2 numerical which uses only two symbols. In this system, numbers are represented as the rows of 0’s and 1’s. Each digit is referred to as a ‘Bit’. The collection of 4-bit is known as ‘Nibble’ and 8-bits forms a ‘Byte’.

### What is a Decimal Number System?

Decimal numbers are also known as Hindu-Arabic Numbers. This is a positional number system. It is also called a base-10 system as it uses 10 symbols to represent the numerical. symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 are used in this system. The symbol ‘0’ was invented in India and the idea was carried to the East by Arabians during trades. Thus, this system is popularly known as the Hindu-Arabic system. The use of this system in western culture was started during the 12th Century in commerce and sciences.

### Use of Binary Number System

In 1847, George Boole in his paper ‘The Mathematical Analysis of Logic’ described Boolean Algebra. This system was based on binary ON-OFF logic. Claude Shannon noticed the similarity between the Boolean Algebra and logic of electric circuits. In 1937, Shannon published his findings in his thesis, which became the initial point from where the binary system is being used in Digital Logics, Computers, Electric Circuits, etc…

All modern computers use binary encoding for their instruction set and data storage. Digital data is stored in the form of binary bits. Digital wireless communication transfers data in the form of binary bits.

### Decimal to Binary Conversion Method

We use decimal numbers in our day-to-day life calculations and numbering. But machines like computers and electronic equipment use binary and can only understand the binary data. So, it is important to convert the decimal numbers into binary numbers.

To convert a decimal number into binary, divide the number with 2. Write the result below and the remainder on the right-hand side. If there is no remainder write a 0. Divide the result with 2 and continue the above process. Repeat the process until the result is ‘0’. Read the remainders from bottom-up, this gives the binary equivalent of the given decimal number. MSB is the bottom remainder whereas the first remainder forms the LSB of the binary number.

### Decimal to Binary Conversion Example

Let us look at an example to understand the decimal to binary conversion method. Decimal numbers are represented with a base 10 whereas the binary numbers are represented with a base 2.

The rightmost bit of the binary number is known as the Least significant bit and the left-most bit is known as the Most Significant Bit.

In the example above, the binary conversion of the decimal number 65 is given. The upward arrow indicates the order in which the remainders are to be noted down.

### Binary to Decimal Conversion Method

A decimal number is also known as the Base-10 number. It is a positional numbering system so, the place value of the digits is to be known. Starting from the Right-hand side, place values in the decimal number system are the powers of 10. For example, for 1345 – Place value of 5 is 10^{0} .i.e. 1, Place Value of 4 is 10^{1} which is the tenth place. Similarly, next place values are 100, 1000, etc…

So, the given number can be decoded as

**(1×1000 )+(3 ×100)+(4×10)+(5×1) = 1345.**

The binary number system is also a positional numbering system. Here, the base is 2. So, powers of 2 are used to find the place values. Thus, to convert a binary number into a decimal number, binary digits are to be multiplied with the powers of 2 and added.

### Binary to Decimal Conversion Example

To understand the conversion, let look at an example. Let us convert 1101_{2} into a decimal number.

Starting from the LSB, 1101_{2} = (1×2^{3})+(1×2^{2})+(0×2^{1}) + (1×2^{0})

= (1× 8)+(1×4)+(0×2)+(1×1):

= 8+4+0+1:

= 13_{10}

Thus, the decimal representation of 1101 is 13.

### Decimal to Binary Encoder

Encoders are used as code converters in computer systems. These are available as IC’s in the market. To convert a decimal number into binary a Decimal to BCD Encoder is used. In the BCD system, the decimal number is represented as the four-digit binary. It can convert the decimal numbers from 0 to 9 into the binary stream.

The encoder is a combinational logic circuit. The reverse of the encoder is a decoder that performs the reverse action. The truth table of Decimal to BCD encoder is given below.

From the truth table above form the equations for the words A3, A2, A1, A0. Thus the logical equations are as below-

A3 = 8+9: A2 = 4+5+6+7 : A1 =2+3+6+7 : A0= 1+3+5+7+9

Now, considering the logic equations above, form the combinational circuit with OR gates.

Digital technology is replacing analog methods in many fields of science, communication, and commerce. Various accurate and affordable consumer electronics are also increasing in number. All these systems take input data in various forms and representations such as alphabets, decimals, hexadecimal, etc..But internally all the data is processed and stored in the form of binary numbers and bits. Thus, for a computer programmer and developer, it is important to know the relation of all these various types of data with the binary numbering system. Check your understanding of the binary conversion by converting the decimal number 45 into its binary equivalent.