Hongmu Notes

🅾️ Text to binary

Convert the entire text into 0 and 1 character by character, each character is a group, and the groups are separated by spaces.

Text to binary

Instructions for use

Paste the text into the upper input box and click "Convert": each character will output a group of 0 and 1 according to its code point, with a space separating the groups, and the result will appear in the lower result box. The number of digits is not fixed - 7 to 8 digits for English and punctuation, more than 15 digits for commonly used Chinese characters, and maybe 17 digits for emoticons; spaces will be converted into 100000, and line breaks into 1010, so the blanks and line breaks in the original text can be seen from the results. The output does not perform zero padding and does not split surrogate pairs. It is consistent with the "binary to text" caliber and can be restored and verified by each other. All conversions are completed locally in the browser and are not uploaded or retained.

✅ How to check the results

  • The number of groups should equal the number of characters (spaces and newlines also count as characters)
  • When the first character is H, the first group should be 1001000
  • Pasting the result into "Binary to Text" should restore the original text

🔒 Data and privacy

The conversion is completed locally in the browser, and the input and results are not uploaded or retained, and will be cleared when the page is refreshed. The binary result is not equal to encryption. Anyone can restore it in the same way. Please do not use it as a means of confidentiality.

binary encoder

Some downstream require a fixed number of digits. Here we explain clearly "when and how to add zeros."

📌 The respective uses of fixed length and variable length

The variable length (the default output of this tool) is suitable for human reading and verification: the number of digits is the actual length of the code point, and you can tell at a glance which groups are English and which are Chinese characters. Fixed length (e.g. unified 8-bit) is suitable for machine processing: when downstream programs parse by fixed-length slices, if the lengths are uneven, they will be read incorrectly. Therefore, it is not who is more correct between the two, but they serve different purposes. If you really need to fix the length, just copy the result to the editor and complete the leading 0s in groups, and the value will not change.

  • Indefinite length: easy for people to read and check the number of digits
  • Fixed length 8 bits: It is convenient for the program to parse according to the fixed length.
  • Complementing leading 0 does not change the value, only changes the writing

🧭 Practical suggestions for completing the digits

If you want to unify it into 8 bits, please note that it is only meaningful for characters with "code points less than 256"; Chinese character code points far exceed 255 and cannot be crammed into 8 bits, and hard padding will result in incorrect results. Therefore, when encountering text containing Chinese, the correct approach is to unify by a larger fixed length (such as 16 bits) instead of 8 bits.

All keywords and tutorials 12

❓ FAQ

Can I add zeros on the page with one click?
This tool outputs the code points as they are; for zero padding, please process the groups that need to be unified in the editor. Note that Chinese characters cannot be represented by 8 bits.
Will padding with zeros change the result?
No, leading 0 does not change the value; conversely, 01000001 and 1000001 will not be treated as different characters during parsing.
Can you specify the number of output digits?
No, the actual number of digits per code point is output; when it needs to be uniformly completed to 8 digits, leading 0s can be manually added to the result, and the value remains unchanged.