Convert Decimal to Binary and Vice Versa

by MrRedBeard in Circuits > Tools

18530 Views, 23 Favorites, 0 Comments

Convert Decimal to Binary and Vice Versa

BinaryIntro.png

This is a technique that helped me out a lot when learning about AND OR NOR gates, creating subnet masks and helped me pass time seeing how high I could get with the binary sequence (not very far). I was able to teach my son this method when he was 7 or 8.

I plan to eventually make this a Computer Science Collection of Instructables to help teach kids. If anyone would like to help out, provide suggestions and/or write Instructables for this collection let me know.

I keep seeing my Assembly Language Quick Reference Guide on my desk.... There's nothing quick about Assembly at least not for me.

Binary Sequence

BinarySequence.png

The key to this method is laying out the numbers binary sequence which is powers of 2 since binary is base 2. This that much more difficult than counting by 2's. Note that we use base 10 considering we have 10 digits and computers at their lowest level use base 2. People argue that some computers use base 16 but remember that a switch is either on or off, 1 or 0. The numbers will need to be from right to left the lowest number to the highest number. This is illustrated by the second picture in the collection.

Binary to Base 10

BinaryToDecimalExample.png
ConversionTable.png

Here we will use the sequence table (2nd Image) to find the base 10 number. Use the visual (1st image) to get a better idea of how this works.

So here you have a given binary number.

  1. You will fill in the table from right to left with the 1's & 0's from the binary number.
  2. You will find the decimal numbers that have a 1 and not a zero. Remember that 1 is on and 0 is off.
  3. Add the decimal numbers you found in the previous step together to get the decimal value of the binary number that you were given.

Decimal to Binary

DecimalToBinaryExample.png
ConversionTable.png

Here we will use the sequence table (2nd Image) to find the base 2 number. Use the visual (1st image) to get a better idea of how this works.

So here you have a given decimal (base 10) number.

  1. Find the highest number that will go into your given decimal number.
  2. Place a 1 in the table for each number that you were able to subtract.
  3. Subtract that number from your decimal number.
  4. Find the next highest number that will go into the number from number 3.
  5. Repeat steps 1-5 until you have a zero remainder.
  6. Your binary number will not start with zero but everywhere else that you have a blank fill in a zero (see example)

Try It for Yourself

ConversionTable.png