Text Encoding Inspector
Re-encode input text as UTF-8 and inspect character counts, code points, byte counts, line and word counts, encoding flags, plus Base64, hex and URL encoding output.
FreeOnline Tool
Loading…
Rate this tool
Your rating helps others decide whether this tool is worth using
How to Use
Type or paste text into the box and the analysis updates in real time.
- Type or paste text into the input. When the input is empty, the results area is hidden.
- Review five statistics: character count (UTF-16 units), code point count, UTF-8 byte count, line count and whitespace-separated word count.
- Read the encoding hint and the flags for Chinese, Emoji, Latin letters, digits, whitespace, control characters, U+FFFD replacement characters, BOM, multi-byte UTF-8 and ASCII-only text.
- View the Base64 (UTF-8), hexadecimal (UTF-8, space-separated) and URL-encoded (UTF-8) results below, and use the Copy button for each.
- Click Load Sample Data to insert a mixed Chinese/English, Emoji and multi-line example; click Clear to empty the input.
Note: text in the browser is already a Unicode string, so this tool cannot recover whether it originally came from GBK, Shift-JIS or another byte encoding. It shows the byte characteristics after re-encoding to UTF-8, not detection of the original file encoding.
Features
- Shows both the UTF-16 code-unit character count and the Unicode code point count, making differences for emoji and other supplementary-plane characters visible.
- Calculates UTF-8 byte count, line count (CRLF, CR and LF supported) and whitespace-separated word count.
- Ten feature flags: Chinese, Emoji, Latin letters, digits, whitespace, control characters (excluding tab, newline and carriage return), U+FFFD replacement characters, BOM, multi-byte UTF-8 and ASCII-only.
- Encoding hints adapt to ASCII-only text, U+FFFD presence or the number of non-ASCII code points, with an extra note about the EF BB BF BOM when present.
- Outputs Base64, space-separated lowercase hexadecimal and URL percent-encoding, all based on UTF-8 bytes.
- One-click copying for all three encodings; input and results are processed locally.
Use Cases
Trace garbled text
Check for U+FFFD or unexpected control characters to determine whether garbling came from a decoding error, a BOM or the copy process.
API and frontend debugging
Compare UTF-8 byte counts, hexadecimal output or Base64 against what an API is actually transmitting.
Generate encoded values
Convert Chinese text or emoji to Base64, hex or URL encoding for config files, request parameters or test cases.
Understand UTF-8 and UTF-16
Use the differences between character, code point and byte counts to see how emoji are represented in UTF-16 versus UTF-8.
FAQ
Can it tell whether the original file was GBK or UTF-8?
No. The browser provides an already-decoded Unicode string, so the original byte information is gone. This tool re-encodes the text to UTF-8 and shows its byte characteristics; it cannot determine whether the source was GBK, Shift-JIS or another encoding.
Why do the character count and code point count differ?
The character count uses JavaScript UTF-16 code units, while the code point count uses Unicode code points. Supplementary-plane characters such as emoji use 2 UTF-16 code units but count as 1 code point, so the numbers differ.
How many UTF-8 bytes do Chinese characters and emoji use?
ASCII characters use 1 byte, common Chinese characters usually use 3 bytes, and emoji usually use 4 bytes. The tool calculates the actual total for your text and explains how many bytes the non-ASCII code points occupy.
What does a U+FFFD replacement character mean?
U+FFFD usually means an earlier decoding step used the wrong encoding, so bytes that could not be mapped were replaced with �. The tool flags this character so you can check the source encoding and transport path.
How is the BOM flag determined?
The tool checks whether the first character is U+FEFF. It is flagged only when the input actually begins with a BOM; the UTF-8 BOM is encoded as EF BB BF.
What are the Base64, hex and URL outputs?
All three represent the text's UTF-8 bytes: Base64 uses the standard alphabet, hexadecimal lists lowercase space-separated byte values, and URL encoding percent-escapes bytes while keeping unreserved characters such as A-Z, a-z, 0-9 and -_.!~*'().