TXT Encoding Detector

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 “é”.

UTF-8, UTF-16, ASCII, Windows-1252BOM and line endingsConvert to UTF-8Last updated: November 4, 2026

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

  1. 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.
  2. Zero bytes: UTF-16 text without a BOM has a zero byte next to every ASCII letter.
  3. All bytes below 128: the file is plain ASCII, which is valid in nearly every encoding.
  4. Strict UTF-8 test: if the bytes form valid UTF-8 sequences, it is almost certainly UTF-8.
  5. Otherwise: it is most likely Windows-1252 or ISO-8859-1.
Note: detection is a best guess. A short file with a few accented letters can be ambiguous. Check the preview to confirm.

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.

Scroll to Top