Binary numbers

You've probably heard that computers deal with data in the form 1s and 0s. Because there are two digits (0 and 1), these are called Binary Digits, or Bits. A bit is the smallest amount of information we can talk about. In the physical world, it corresponds to something having an electric current or not. We can also refer to a bit as "on or off" or "true or false." It all works out the same. Because there are two digits, we use a binary numbering system. You are very used to using a numbering system with 10 digits (0 through 9). In this system, we use place values, so that each multiple of 10 (ones, tens, hundreds, and so on) have their own digit. For example, 1024 means 1 thousand, 0 hundreds, 2 tens, and 4 ones. Binary numbers work just the same way. The place values are multiples of 2 (one, twos, fours, eights, sixteens, and so on). So the binary number 10011 is 1 sixteen, 0 eights, 0 fours, 1 two, and 1. In decimal numbers, that's 16 + 2 + 1, or 19. It's important to understand binary numbers, since they form the basis for computing at a very low level.

01a Binary

Converting binary to decimal numbers

  1. Write out your place values, you'll need as many as you have binary digits:

64 32 16 8 4 2 1

  1. Write your binary digits underneath the place values:

64 32 16 8 4 2 1

1 1 1 0 0 1 1

  1. Add up the place value numbers that have a 1 underneath them.

64 + 32 + 16 + 2 + 1 = 115


Binary starts at 4:48

Converting decimal to binary numbers

Converting decimal to binary is just a bit more difficult. It resembles long division a bit. But with just a little practice, it becomes easy.

  1. Write out your place values

  2. Starting at the left, is your decimal number larger than the place value?

    1. No - write a 0 under the place value and move on to the next place value

    2. Yes - write a 1 under the place value, subtract the place value from the decimal, and move to the next place value

    3. Repeat until you have reached the last place value

Example: Convert 231 to binary

  1. 128 64 32 16 8 4 2 1

231 is larger than 128, so we'll

Example: convert 231 to a binary number

  1. Write out place values


  1. 231 is larger than 128, so we put a 1 under 128, and subtract 231-128 to get 103


  1. 103 is larger than 64, so we put a 1 under 64, and subtract 103-64 to get 39


  1. 39 is larger than 32, so we put a 1 under 32, and subtract 39-32 to get 7


  1. 7 is smaller than 16, so we put a 0 under 16 and move on.


  1. 7 is smaller than 8, so we put a 0 under 8 and move on.


  1. 7 is larger than 4, so we put a 1 under 4, and subtract 7-4 to get 3



  1. 3 is larger than 2, so we put a 1 under 2 and subtract to get 1.


  1. We have 1 left, which fits perfectly under the 1s place value, so we're done!


231 decimal = 11100111 binary




128 64 32 16 8 4 2 1


128 64 32 16 8 4 2 1

1

128 64 32 16 8 4 2 1

1 1


128 64 32 16 8 4 2 1

1 1 1

128 64 32 16 8 4 2 1

1 1 1 0

128 64 32 16 8 4 2 1

1 1 1 0 0

128 64 32 16 8 4 2 1

1 1 1 0 0 1


128 64 32 16 8 4 2 1

1 1 1 0 0 1 1

128 64 32 16 8 4 2 1

1 1 1 0 0 1 1 1

11100111



Making letters from numbers - ASCII