Computers store text as numbers, and numbers as binary, strings of 0s and 1s. Converting text to binary is therefore a two-step job: first turn each character into a number, then turn each number into binary. Once you see the method on a short word, you can do it for any text, and a converter can do the same job instantly when the text gets long.
How text becomes binary
Every character has a number. In the ASCII system, capital A is 65, capital H is 72, lowercase a is 97, and a space is 32. Those numbers are then written in binary, using 8 bits each, with leading zeros to fill the byte. So H, code 72, becomes 01001000, and i, code 105, becomes 01101001. Characters outside plain English, such as accented letters or emoji, use more than one byte in the UTF-8 system, which is why a short word can produce a longer binary string than you expect. For ordinary English text, one byte per character is the rule to learn first.
How to convert text to binary by hand
- Write out the text, one character at a time. For Hi, the characters are H and i, plus any spaces or punctuation, each of which counts.
- Find each character’s number. Use an ASCII table: H is 72, i is 105, a space is 32. Write the numbers in order.
- Convert each number to binary by dividing by 2. Divide the number by 2, write down the remainder, and repeat with the result until you reach 0. Read the remainders from the bottom up.
- Pad each result to 8 bits. Add leading zeros until each binary number is 8 digits long. This gives one byte per character.
- Join the bytes with spaces. Spaces between bytes make the result readable and make decoding possible later.
- To decode, reverse the steps. Split the binary into 8-bit groups, convert each group back to a number, and look up the character for that number.
A worked example
Take the word Hi. H is character code 72. Divide 72 by 2 repeatedly and read the remainders from the bottom up: 1001000, padded to 8 bits as 01001000. Lowercase i is 105, which becomes 01101001 by the same method. Together, with a space between the bytes, Hi is 01001000 01101001. To decode, split the binary into 8-bit groups, turn each group back into a number, and look up the character for that number. The same steps work for any plain text.
Mistakes to avoid
- Do not drop the leading zeros. 1001000 is not the same byte as 01001000, and dropping zeros shifts every following character.
- Do not confuse a digit with its character code. The text character 1 has code 49, not 1, so its binary is 00110001, not 00000001.
- Do not forget that capital and lowercase letters differ. A is 65 and a is 97, so case matters in binary just as it does in text.
- Do not decode without splitting into 8-bit groups first. Reading a long unbroken string as one number gives nonsense.
Try it faster with the free tool
The free Online Text to Binary Encoder/Decoder below does both directions: it turns plain text into 8-bit binary code, and turns binary code back into readable text. Choose a mode, type or paste in the box, and click Convert. It runs fully in your browser, with nothing to install and no sign-up.
Try it here: Online Text to Binary Encoder/Decoder.
Character to number, number to bits, bits in order. That is the whole method, and once you can do it for Hi, you can do it for any text.
