How does a computer convert text into binary or 0's and 1's?
Before moving to know how does a computer convert text into binary, you should first know about the binary, what it is, and why it is important for a computer.
When we represent a number in a binary number system or base 2 number system called binary. In Binary System, we define the symbol as 1 and 0. The propositional position of the binary number system is 2.
Computers use this numerical system to store and retrieve data such as numbers, music, pictures, words, text, etc. The term 'bit,' which refers to the smallest digital technology unit, is derived from' BInary digiT.' In modern times, programmers utilize the hexadecimal or base-16 number system to express binary data concisely because it is easier for computers to convert from binary to hex and vice versa, whereas doing so with the generally used decimal number system is far more difficult.
In the early days of computing, computers used analogue to solve issues, but this was not as precise as binary code. Therefore, those computers were mostly converted into digital computers that employed binary code.
Binary numbers are used in the creation of computers and related technologies. Computers require a large number of transistors to complete their tasks. However, using binary numerals made it easier and less costly.
Example of conversion
Words and other facts are converted to binary by computers using ASCII (American Standard Code for Information Interchange) values. Once you have the ASCII value, you can transform it to binary. The first computer looks at our entered letter. Then it searches those letter’s values from the ASCII value table. The whole process of conversion from text into binary has been shown below:
Consider the phrase JAVASCRIPT as an example to explain how it's transformed into the binary that the computer can interpret.
Character | J | A | V | A | S | C | R | I | P | T |
ASCII | 74 | 65 | 86 | 65 | 83 | 67 | 82 | 73 | 80 | 84 |
Binary Values | 01001010 | 01000001 | 01010110 | 01000001 | 01010011 | 01000011 | 01010010 | 01001001 | 01010000 | 01010100 |
Let's disintegrate the method for the first letter, J. When you write the letter J (in uppercase) by the keypad, it sends a signal to the system, which interprets as input. The ASCII value obtained for J is 74, which can be translated to the binary number 01001010 by the desktop operating system.
The computer may retain and analyse the information as ones (on) and zeros (off) just after J is translated to binary (off).
Each letter takes 8 bits (1 byte) to save; therefore, for the word "JAVASCRIPT", it will take 80 bits (10 bytes) to save as plaintext.
How and why does the computer convert binary back into text?
When the system wants to transform binary data back to the human-understandable text, it follows the same steps as before. Using the ASCII standards conversion, a system may transform the binary 01101000 to the decimal number 104, which it recognizes as the letter h. As a result, the letter 'h' appears on your computer's monitor.
If it weren't for the computer system's super-fast processing power, entering text, writing commands, and getting that text shown on the computer screen would be lengthy and complex. The letters and words we type are transformed into machine-understandable binary codes and then displayed as human-understandable text. We don't have to go through the entire process, but understanding a few essential principles in the following sections will help us understand how binary codes are transformed into text.
The Role of ASCII Code
The binary code, unlike those used for other computer languages, is not easy to convert. When you type in a set of binary codes, the encoded set does not instantly transform to the desired character, word, or function. This is why it requires an additional code known as ASCII (American Standard Code for Information Interchange) to aid in its recognition by the computer's system and conversion into letters and words. In basic comparison, ASCII can be compared to the intermediary that serves as a link between a company and its customers. Converting binary code to text and vice versa serves the same duty as an intermediate.