TXT Encoding Detector
The TXT encoding detector examines the bytes of a text file and tells you whether it is UTF-8, UTF-16, plain ASCII or an older single-byte encoding such as Windows-1252. It also reports the byte order mark (BOM) and line endings, shows a preview, and can save a clean UTF-8 copy. Use it when accented letters turn into strange symbols such as “é”.
Detect a text file’s encoding
What an encoding is
A text file is just bytes. The encoding is the rule that turns those bytes into letters. UTF-8 can represent every language and is the standard on the web. UTF-16 is common in files saved by older Windows programs. Windows-1252 (often called “ANSI” in Western Europe and the US) uses one byte per character and only covers Western languages.
How detection works
- Byte order mark: files starting with EF BB BF are UTF-8, FF FE is UTF-16 little-endian, FE FF is UTF-16 big-endian.
- Zero bytes: UTF-16 text without a BOM has a zero byte next to every ASCII letter.
- All bytes below 128: the file is plain ASCII, which is valid in nearly every encoding.
- Strict UTF-8 test: if the bytes form valid UTF-8 sequences, it is almost certainly UTF-8.
- Otherwise: it is most likely Windows-1252 or ISO-8859-1.
Why text looks garbled
- “é” instead of “é”: a UTF-8 file was opened as Windows-1252.
- “�” characters: a Windows-1252 file was opened as UTF-8.
- Letters separated by spaces or null characters: a UTF-16 file was opened as a single-byte encoding.
- Strange first characters “”: a UTF-8 BOM shown as text by a program that does not expect it.
Frequently asked questions
Is my file uploaded?
No. The bytes are read and analysed in your browser.
Should I save as UTF-8 with or without a BOM?
Without, for the web, code and most tools. Some older Windows programs, including Excel for CSV files, need the BOM to recognise UTF-8.
Does it detect Asian encodings such as Shift-JIS or GBK?
No. Those files will be reported as a single-byte encoding. Use a dedicated converter if you work with them.
