How to Convert Decimal Number to Binary: 10 Steps

Table of contents:

How to Convert Decimal Number to Binary: 10 Steps
How to Convert Decimal Number to Binary: 10 Steps

Video: How to Convert Decimal Number to Binary: 10 Steps

Video: How to Convert Decimal Number to Binary: 10 Steps
Video: How To Find The Domain of a Function - Radicals, Fractions & Square Roots - Interval Notation 2024, May
Anonim

The decimal (base ten) number system has ten possible values (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9) for each number position. In contrast, the binary (base two) number system has only two possible values represented by 0 and 1 for each number position. Since the binary number system is the internal language of electronic computers, serious computer programmers know how to convert from the decimal to binary number system. Follow these easy steps and also how to master this conversion.

Step

Method 1 of 2: Short Division by Two with Remainder

Convert from Decimal to Binary Step 1
Convert from Decimal to Binary Step 1

Step 1. Determine the problem

For this example, let's convert the decimal number 15610 be a binary number. Write the decimal number as the number to be divided in the inverted division symbol. Write the base of the destination number system (in this example “2” for binary) as the out-of-curve divisor of the division symbol.

  • This method is much easier to understand when drawn on paper, and much easier for beginners, because it only divides by two.
  • To avoid confusion before and after conversion, write down the base number of the number system you are calculating as a subscript (lowercase written under normal letters as a distinguishing sign) for each number. In this example, the decimal number will have a subscript of 10 and the binary number will have a subscript of 2.
Convert from Decimal to Binary Step 2
Convert from Decimal to Binary Step 2

Step 2. Do the division

Write the integer answer (quotient) under the long division symbol, and write the remainder (0 or 1) to the right of the divided number.

Because we divide by two, when the number being divided is an even number then the remainder is 0, and when the number being divided is an odd number then the remainder is 1

Convert from Decimal to Binary Step 3
Convert from Decimal to Binary Step 3

Step 3. Continue dividing until it reaches zero

Continue downhill, dividing each new quotient by two and writing the remainder to the right of each divided number. Stop when the quotient is zero.

Convert from Decimal to Binary Step 4
Convert from Decimal to Binary Step 4

Step 4. Write down the new binary number

Starting from the lowest remaining number, read the order of the remainder in ascending order to the top. In this example, you should get the result 10011100. This is the binary equivalent of the decimal number 156. Or, if written with its numeric base subscript: 15610 = 100111002.

This method can be modified to convert from decimal base to any number base. The divisor is 2 because the base of the destination number system is base 2 (binary). If the base of the destination number system is another base, replace the base 2 number in this method with the appropriate base number. For example, if the destination base is base 9, replace the base 2 number with 9. The final result will be directly in the form of the destination base number

Method 2 of 2: Deriving Power of Two and Subtraction

Convert from Decimal to Binary Step 5
Convert from Decimal to Binary Step 5

Step 1. Start by creating a table

Write the powers of the two base numbers in the "table 2 base" from right to left. Start at 20, write it as “1”. Raise the rank by 1 for each rank. Complete the table until you get a number that is closest to the number of the decimal number system you are calculating. For this example, let's convert the decimal number 15610 be a binary number.

Convert from Decimal to Binary Step 6
Convert from Decimal to Binary Step 6

Step 2. Find the number with the greatest power of the base number 2

From the table, choose the largest number that is equal to or less than the number to be converted. The number 128 is the number with the largest power of the base number 2 and is also smaller than 156, so write a number "1" under this box in the table, where the largest number from the table is on the left (see table in the image above). Then subtract 128 from the initial number, you will get: 156 – 128 = 28.

Convert from Decimal to Binary Step 7
Convert from Decimal to Binary Step 7

Step 3. Proceed to the next smaller power in the table

Using the new number (28), continue through the table from left to right while checking whether the numbers are equal to or less than the new number. The number 64 is not less than 28, so write the number “0” under the number box 64. Continue until you find a number that is equal to or less than 28.

Convert from Decimal to Binary Step 8
Convert from Decimal to Binary Step 8

Step 4. Subtract every number that is equal to or less than the new number continuously, and mark the number “1” below the box for the appropriate number

The number 16 is less than 28, so write the number "1" under the number box 16 and subtract 16 from 28, so you get a new number 12. The number 8 is less than 12, so write the number "1" under the number box 8 and subtract 8 from 12 to get the new number 4.

Convert from Decimal to Binary Step 9
Convert from Decimal to Binary Step 9

Step 5. Continue until you reach the end of the table

Remember to mark a “1” under each box for numbers that are equal to or smaller than the new number, and a “0” under each box for numbers that are still greater than the new number.

Convert from Decimal to Binary Step 10
Convert from Decimal to Binary Step 10

Step 6. Write down the answer for the binary number

The number will be exactly the same from left to right as the row of numbers “1” and “0” at the bottom of the table. You should get the result 10011100. This is the binary equivalent of the decimal number 156. Or when written with a subscript: 15610 = 100111002.

Repeating this method can help you remember the powers of the base two, so you can skip step 1

Tips

  • The Calculator program built into the operating system can do this conversion for you, but as a programmer, it's best to start with a good understanding of how conversions work. The conversion options in the Calculator program can be made visible by opening the “View” menu and selecting “Programmer” (for Windows 7 and 8).
  • Converting in the opposite direction, i.e. from the binary to decimal number system, is usually easier to learn first.
  • Frequent practice of converting decimal numbers to binary to become more expert.

Recommended: