How does a computer convert text into binary or 0's and 1's?

Updated: 04/01/2018 by Computer Hope

Computers convert text and other data into binary by using an assigned ASCII value. Once the ASCII value is known that value can be converted into binary. In the example below we take the text "hope" and show how it is converted into binary that the computer understands.

Text into binary on a computer

Let's take the first character "h" and break down the process. Once the letter "h" (in lowercase) is typed on the keyboard, a signal to the computer as input. The computer knows the ASCII standard value for "h" is "104", which can be converted by the computer into the binary value "01101000." After the "h" is converted to binary, the computer can transmit that data using electrical signals or store the information on magnetic media by changing the poles to negative or positive.

When storing this data, each character takes 8 bits (1 byte), which means to store hope as plaintext it would take 4 bytes or 32-bits.

How does the computer convert binary back into text?

When the computer needs to convert the binary data back into text or other information the human can understand, it's the reverse of the previously shown process. For example, a computer may convert the binary "01101000" into the decimal value "104" which it knows is the letter "h" using the ASCII standard conversion. Hence, you see the letter 'h' output to your computer's monitor.

Additional information