Hongmu Notes

↔️ Full-width and half-width conversion

Convert between full-width and half-width: full-width letters, numbers and punctuation are converted to half-width, half-width characters are converted to full-width, and Chinese characters and line breaks are retained as they are.

Full-width and half-width conversion

Note: Full-width ASCII ranges (! to ~) and full-width spaces will be converted to half-width, and half-width printable characters and spaces will be converted to full-width; Chinese characters, line breaks, and other symbols will remain unchanged.


Instructions for use

Paste the text you want to process into the upper input box and click "Convert Full Width to Half Width" or "Convert Half Width to Full Width". The result will appear in the result box below, and you can click "Copy Result" to take it away. The judgment is based on the code value range: full-width visible characters are in the code value 65281 to 65374 (that is, full-width exclamation mark to full-width tilde), which is exactly 65248 different from half-width characters; full-width space code value is 12288, which is interchangeable with ordinary spaces. Therefore, only letters, numbers, punctuation, and spaces will be converted, while Chinese characters, line breaks, tabs, and other symbols will remain intact.

✅ How to check the results

  • Full-width "ABC123" should be converted to half-width "ABC123"
  • Half-width "ABC123" should be converted into full-width "ABC123"
  • Chinese and line number remain unchanged before and after conversion

🔒 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.

Full-width alphanumeric conversion

The copied letters and numbers are full-width, and the numbers always don't match up.

Full-width letters and full-width numbers are only slightly wider visually, but the difference in code value is 65248, so they will be judged as different when compared by strings: fields that require exact matching such as serial numbers, mobile phone numbers, express delivery number, and order numbers are most likely to be tricked by it. After converting them to half-width, the display width returns to one English character, and field verification and length statistics become normal. If you only want to process letters and retain the full-width form of numbers, you can first convert the entire section to half-width and then manually change it back to numbers.

  • Convert full-width ABC to ABC
  • Convert full-width 123 to 123
  • Repair number and mobile phone number failed to compare
  • Character length statistics return to normal

When encountering a number with a long digit, it is recommended to count the number of characters again after conversion: the number of full-width and half-width characters is the same, but if the full-width character is mistakenly treated as two characters, the statistical value will be too large. This step can help confirm whether the conversion is consistent.

All keywords and tutorials 12

❓ FAQ

What should I do if the number may be full-width or half-width??
Rotate a half-angle before warehousing or comparing to avoid duplication and missed matching caused by the two forms.
Will the length change after conversion??
The number of characters remains unchanged, but the display width becomes narrower; if the length is counted in bytes, the value will become smaller.
Will numbers be converted as well?
Yes, full-width numbers will be converted into half-width numbers; if you only want to process letters, you can convert first and then manually restore the number part.