Skip to main content
Chemistry LibreTexts

Binary Numbers

0 and 1. These are the only two symbols available in a binary counting system. The reason binary numbers dominate electronics is that these numbers correspond to off and on, false and true, switch open and switch closed, magnetized in one direction, magnetized in the other, light x-polarized or light y-polarized. Any more complicated idea can be made by aggregating multiple binary bits
(1 bit = a single 0 or 1) in assemblies: nybbles (4 bits), bytes (8 bits), words (16 bits), or long words (32 bits).

Place value works for binary just as it does for the decimal system. In ordinary decimal numbers 234 means 2×100 + 3×10 + 4×1 or 2×102 + 3×101 + 4×100. Each place has a digit in the range 0 through 9 times the base of the number system (10) raised to an integer power. If we looked at real numbers, those including a decimal point, numbers past the decimal would feature the base raised to a negative power. ANY based raised to the 0 power is 1. The position immediately to the left of base0 is valued at base1 which for binary means 21 = 2. So the first few binary numbers are: 00, 01, 10, 11 which correspond to the base 10 numbers 0, 1, 2, and 3.

Exercise: 16 bit numbers (words) are commonly used in digitization and computers. What are the place values for the first 16 places in a binary number? Fill in the blanks in this table: 

Power of 2 Base 10 (decimal) Value

Converting back and forth between decimal and binary is easy. First, if you're a Windows user, pop up the Accessories Calculator. Set View to Scientific. Type in a decimal number, click "Bin" in the upper left, just below the data entry box, and there's the binary equivalent. Similarly, type in a string of 0's and 1's, click "Dec," and there's the decimal value. How does that work? Let's do one conversion each way.

84 (base 10) is between 26 = 64 and 27 = 128. That says we'll need 7 bits to express 84 in binary, and the most significant position will be a 1 in the 6th place. That 1 will represent 64 out of 84 counts, leaving 20 (84-64) to be encoded. So at this point, we have 1xxxxxx. The next position, 25, has a decimal value of 32. But 32 is bigger than 20, so this position gets a 0, and we have 10xxxxx. The next position is 24 = 16, which is less than 20. So that gets set to 1, and we have 101xxxx with a remainder to be encoded of 20 - 16 = 4. We recognize that 22=4, so the 4's place will have 1 and all the other places will have 0's, so the encoding is 1010100. Here's a shortcut: ALL odd numbers will have a 1 in the 1's place.

What if we're going in the other direction -- converting base 2 to base 10? Just add up the place values (from the table you filled in) anywhere you see a 1, and ignore the places where there's a 0. 1001001 = 1×26+1×23+1×20 = 64+8+1 = 73.

Incidentally, characters such as those you're reading right now are also encoded in binary. For simple alphabetic characters, the ASCII encoding is common. To enable use of all the character sets of all the languages of the world, Unicode is employed.

Exercise: Express 17487 as a binary number.

Exercise: Express 1001111000 as a decimal number.