Text to Binary: How Characters Become 1s and 0s
Computers store each character as a number, then as bits. Learn how text becomes binary through UTF-8 encoding, and how to convert it both ways.
To turn text into binary, each character is mapped to a number (its code point), encoded as bytes with UTF-8, and each byte written as eight bits. For example, the letter A is code point 65, or 01000001 in binary.
The two steps
- Character to number — every character has a Unicode code point;
Ais 65,ais 97. - Number to bits — the byte value is written in base 2, padded to 8 digits per byte.
UTF-8 and multi-byte characters
Plain ASCII letters take one byte (8 bits). Accented letters, many scripts and emoji take two to four bytes, so they become several groups of eight bits.
Reading it back
Decoding reverses the process: group the bits into bytes, read each as a number, and map back to characters via UTF-8.
Try it
Convert either way in the text to binary converter. To understand the number bases behind it, see binary, decimal and hex.