How to Convert Binary to Decimal?

Show us in this article the systems of numbers and binary numbers, how to Convert binary to decimal digits and vice versa. We also define a mathematical change of binary and a list of simple Java programs, JavaScript, and Python to change binary digits.

The decimal and binary numerical systems are two of the most used system numbers in the world. The perfect system is most trusted with us and is used anywhere in daytime calculations. It has a base of 10 – ie 10 digit numbers or 0, 1, 2, 3, 5, 8, and 9.

Almost all computer and digital devices perform a binary system because electronic circles are implemented easily by logical gates. In computers, each binary number is called a “bit“. For example:

  • 10 is a 2-bit binary number, where 1 and 0 are bits
  • 110 is a 3-bit binary number
  • 11011 is a 5-bit binary number

There are various methods and programs for Convert Binary to Decimal and vice versa. Let’s first look at the most common method used for conversion, and then examine the more detailed mathematics behind converting a decimal system to binary.

How to Convert Decimal Numbers to Binary?

Let’s look at two cases – converting decimal integers to binary and then decimal fractions less than 1 to binary.

Decimal integers to binary: Algorithm

  1. Share an integer with 2, while the quiet is set and left.
  2. Divided approximately 2 and record 3rd quotes and left.
  3. Such to remain consistent distribute each successive quote 2 until you get quite zero.
  4. Then only write all the other repeated order to get binary representations of the whole.

For example, let’s convert the integer 15 to binary. Divide the integer by 2 successively while noting the quotient and remainder.

  • 15/2 = 7 (remainder = 1)
  • 7/2 = 3 (remainder = 1)
  • 3/2 = 1 (remainder = 1)
  • 1/2 = 0 (remainder = 1)

Then write down everything that is left in reverse order. In this example, the remainder is 1, 1, 1, 1. Thus, when written in reverse order, the number 15 in the decimal system is represented as 1111 in binary form. For each integer, we take Example 10.

  • 10/2 = 5 (remainder = 0)
  • 5/2 = 2 (remainder = 1)
  • 2/2 = 1 (remainder = 0)
  • 1/2 = 0 (remainder = 1)

So, the decimal number 10 is represented as 1010 in binary.

Decimal fractions to binary: Algorithm

To convert a fraction to binary, follow the opposite of the process described above.

  1. Multiply Part 2 when announcing the results of the entire number and fractional part of the product.
  2. Continue multiplying consecutive functions 2 until you receive the resulting product in zero fraction.
  3. Now write down all the complete parts of the product at every step.

For example, let us convert the fraction 0.625 to binary. Multiply the fraction by 2 successively while noting the integer and fractional parts of the product.

  • 0.625*2 = 1+0.25
  • 0.25*2=0+0.5
  • 0.5*2=1+0

We see that the resulting integer parts of the product are 1, 0, 1. Hence, just write these after the decimal point to get the binary notation. So, 0.625 can be written as 0.101 in binary.

How do convert binary numbers to decimals?

Let’s look at two cases – change the binary whole numbers perfectly, and then be imprisoned them in binary language.

Binary integers to decimal: Algorithm

  1. To convert a binary integer to decimal, start by adding the leftmost digit to 0.
  2. Next, multiply this by 2, and add the next digit in your number (as you progress from left to right) to this product. (In other words, multiply the current product in each step by 2 and add the current digit).
  3. Continue this process until there are no more digits left.

For example, we keep the binary integer 1001 to perfect. Multiply the total number of 2 and add the current number, starting from the left.

  • 0*2+1=1
  • 1*2+0=2
  • 2*2+0=4
  • 4*2+1=9

Hence, the binary to the decimal conversion of 1001 is 9.

Binary fractions to decimal –

  1. To change the warned recognition function, starting with the correct top number to 0.
  2. Share it with 2, add the following number to this sum (left to the right to the left), and so on.
  3. Continue until there are numbers away.

For example, we move particles 0.1101 to a decimal place. Share the total number of 2 and add the current number on the right.

  • 1/2*(1+0)=0.5
  • 1/2*(0+0.5)=0.25
  • 1/2*(1+0.25)=0.625
  • 1/2*(1+0.625)=0.8125

As seen, the decimal representation of 0.1101 is 0.8125.