🗄️ Convert string to binary
Enter a piece of text and get a binary string of 8 bits each.
Convert string to binary
Instructions for use
- Encoded according to UTF-8: 1 byte for English numbers, 3 bytes for Chinese characters, 4 bytes for emoticons
- Output a continuous 8-digit fixed-length string, which can be restored by pasting it back into "Binary to String"
- All is done locally in the browser, and the input content will not be uploaded.
Convert character to 8-bit binary
When only converting one or two characters at a time, the most concerned thing is "how many groups does it occupy?" After the tool outputs UTF-8, the number of groups is equal to the number of bytes. The rules are clear and easy to remember.
📌 The relationship between group number and character type
| character | Number of groups (bytes) | result |
|---|---|---|
| A | 1 | 01000001 |
| Hi | 2 | 0100100001101001 |
| in | 3 | 11100100 10111000 10101101 |
| Emoticons | 4 | 11110000 10011111 10011000 10000000 |
⚙️ Why do we need 4 sets of expressions?
Common emoticons lie outside the Unicode base plane, and UTF-8 is represented by 4 bytes, so 4 sets of 8 bits are output. The old way of writing by character code unit will split it into two incomplete fragments, which cannot be restored.
🧭 Suitable teaching usage
When you want to explain "why Chinese takes up 3 bytes", you can directly convert the Chinese characters and letters separately, and compare the two sets of results side by side. It is much more intuitive than verbal explanation.
📌 Use the comparison table to understand the number of groups
It is enough to remember three categories: 1 group of ASCII characters, 3 groups of commonly used Chinese characters, and 4 groups of emoticons. Before converting, you can first check which category is dominant in the text, so you can estimate the length of the result and have an idea when checking.
📌 Notes on converting multiple characters at the same time
When multiple characters are entered at the same time, the result is that the bytes of each character are concatenated in sequence. When checking, first group by 8 bits, and then divide the boundaries by character width, you can confirm whether each character is converted correctly, and there will be no misjudgment due to lack of delimiters.
All keywords and tutorials 12
❓ FAQ
- Why is there only one group in English?
- Because ASCII characters are 1 byte under UTF-8, 8-bit binary is exactly one set; if there are fewer digits, one byte cannot be filled.
- Do numbers and punctuation follow the same rules?
- Half-width numbers and punctuation are both 1 byte, and one group is output; full-width punctuation, like Chinese characters, occupies 3 bytes, and three groups are output.
- What happens to emoticons?
- The emoticon occupies 4 bytes in UTF-8 and will output 4 groups of 8-bit binary. The old writing method will split the expression into two incomplete 16-bit fragments, which cannot be restored.