Hongmu Notes

🗄️ 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.

Text to UTF-8 binary

Many online tools are only correct for single-byte characters and give incorrect results when encountering Chinese characters. This page is uniformly encoded in UTF-8, and Chinese characters, full-width punctuation, and expressions can all be restored to byte sequences.

📌 How many bytes does each character occupy?

contentNumber of bytesNumber of digits
Hi216
Welcome756
Chinese character "中"324
"Chinese abc"1080

⚙️ Why is the old way of writing wrong?

When converting by character code unit, the code unit of Chinese characters is 15 bits and cannot be supplemented as an integer multiple of 8 bits. The resulting string is neither a byte sequence nor can it be restored. This problem disappears naturally after switching to UTF-8 bytes.

🧭 Check method

The status line will give "N bytes, M bits binary converted". Comparing it with the expected number of bytes can quickly reveal whether the input contains unexpected characters (such as invisible spaces).

📌 How to compare with hexadecimal example

Each 8 bits corresponds to two hexadecimal digits. For example, the three groups 11100100, 10111000, and 10101101 in the "center" are E4, B8, and AD. When you have a hexadecimal reference value on hand, you can quickly check whether the result is correct.

📌 Infer text composition from results

Divide the number of digits by 8 to get the number of bytes, and then disassemble it according to the commonly used character widths, and you can determine what the text roughly consists of: in pure English, the number of bytes is equal to the number of characters, and when Chinese appears, the number of bytes will be significantly greater than the number of characters. This conversion is useful when checking data length.

All keywords and tutorials 12

❓ FAQ

Can the results containing Chinese still be restored?
Can. The result is the UTF-8 byte sequence of the original text. Paste the entire segment into the "Binary to String" tool to restore the same Chinese text.
Do full-width punctuation also occupy 3 bytes?
Yes. Full-width commas, periods and Chinese characters are both 3 bytes, and each will output 24 bits during conversion, so the number of digits in the entire text will be significantly increased.
Why does a Chinese character become 3 groups?
UTF-8 uses 3 bytes to represent commonly used Chinese characters, so "中" will get 24 bits and 3 groups of 8-bit binary; letters and numbers only require 1 byte.