File Encoding Detector
Drop a text or file to detect its encoding locally — UTF-8 / UTF-16 / GBK with BOM awareness — and preview the content decoded with the detected encoding.
>_ USAGE GUIDE
Drop a text or file to detect its encoding locally (UTF-8 / UTF-16 / GBK) and BOM state, and preview the content decoded with the detected encoding. When text opens as garbled, using it to figure out "what encoding this is" beats trying encodings at random.
A few concepts help read the result: a BOM (byte order mark) is a few bytes at the start of a file that declare the encoding, and with a BOM the detection is most reliable; without one it relies on byte patterns. Note that UTF-8 and GBK overlap at the byte level, so short or pure-ASCII text can be plausible under both — hence the result is a best guess with a confidence signal rather than an absolute verdict. The order runs roughly: BOM, then strict UTF-8 validation, then a UTF-16 NUL heuristic, then a GBK probe, then a Latin-1 fallback.
- Drop a file or paste text: add the content to inspect
- Read the detected encoding and BOM state: see the result and its confidence
- View the preview: confirm by eye with the live preview
- Copy the text once confirmed: take the correctly decoded text
>_ FAQ
Q1 · Why is the encoding sometimes detected wrong?
Because without a BOM the encoding is inferred from byte patterns, and UTF-8 and GBK overlap in their byte ranges, so short or mostly-ASCII text can fit several encodings. The result is therefore a best guess plus a confidence signal; when confidence is low, confirm with the live preview and switch encodings manually to compare.
Q2 · What is a BOM and should I remove it?
A BOM is a special set of bytes at the start of a file declaring the encoding (such as the UTF-8 BOM); with one, detection is most reliable. Whether to remove it depends on the use: most cases favor removing it to avoid stray characters in some parsers, scripts or concatenations, but where an explicit encoding declaration is needed it can help to keep it.
Q3 · Which encodings are supported?
Mainly UTF-8, UTF-16 and GBK, with Latin-1 as a fallback. GBK detection is heuristic (experimental) and may be imprecise; you can override it. If your text uses another encoding, convert it to one of the common ones with an external tool first.
Q4 · Is my file uploaded?
No. Detection runs in the browser, so the file content never leaves your device and is not stored. Large files are sampled from the head for the preview, so even bigger files are quick. Closing the page leaves nothing behind.
Q5 · How does it differ from the Unicode and file-metadata tools?
The jobs differ: the Unicode tool (unicode) converts escapes like \uXXXX to and from characters, and the file-metadata tool (filemeta) reads size and type metadata, while this tool performs charset encoding detection and preview. Use the first for escapes, the second for metadata, and this tool to detect encoding.