Text to Binary

Text to Binary

Converting text to Binary to text 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. binary to textThe 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.