Translating text to Binary

Converting text to Binary is a two step process. First you need to convert each letter (or character or number) to its decimal equivalent using an ASCII (American Standard Code for Information Interchange) chart. ASCII charts are readily available, but the capital letter A is represented by the number 65 and the lower case a is represented by 97. Each subsequent letter is one number higher than its predecessor, i.e. B is 66 and b is 98, etc. For punctuation, referencing an ASCII chart or using the spreadsheet method is recommended.

Using this method, we will convert the phrase, "Hello World" to decimal. Counting up from 65, we know that the letter H is represented by the decimal number 72. Using the same method, we can convert the rest of the words to decimal. Using an ASCII chart, you will find that the decimal equivalent to a space is the number 32. In this way, we can convert the phrase “Hello World” to the decimal version, which is, "72 101 108 108 111 32 87 111 114 108 100."

Next we need to convert the decimal to binary. To understand how to code in binary, it is useful to first know how to decode binary. As you may know, a binary number is made up of 1s and 0s which represent an on/off state for each bit, which in turn, represents a power of 2. The bits are decoded from right to left with the first bit representing 1, the 2nd is 2, the 3rd is 4 and so on until you get to the 8th position which represents 128. You would then add the value contained in each bit represented by a 1 to get the decimal equivalent. If all of the bits were 1, or 11111111, it would represent the decimal numbers 128 64 32 16 8 4 2 1 which add up to 255.

For example, using the binary 10101010, 2nd, 4th, 6th and 8th bit contain 1s. This would mean that the bits representing 128, 32, 8 and 2 are "on." So the binary number above represents 128+32+8+2 or the decimal number 170. To use this method to convert our phrase above, you will need to take each decimal number in turn and convert it to binary.

To do this, take each number and find the largest number represented by a bit that is less than the number and turn that bit "on." In our example, the largest bit less than 72 is the 7th which represents 64. You then subtract that bit from the number and do the same with the remainder and continue that until you have a binary number equivalent to the decimal number. Following this logic, the binary equivalent of 72 would be 01001000. The bits for 64 and 8 are on, which added up equals 72.

To recap, converting text to binary requires converting each letter or character in the text version to its binary equivalent and then converting that number into its binary form. To close out with our "Hello World" example, the binary for that sentence is as follows:

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100