File Encoding Detector
Upload any text file and detect its encoding — UTF-8, UTF-16 LE/BE, UTF-32, Latin-1, ASCII — with BOM detection, byte signal analysis, and a hex preview.
How to use
- Drop or pick any text file. Detection runs in your browser — the file never leaves the page.
- Check the BOM panel first: a BOM means the encoding is essentially certain. No BOM means heuristic detection.
- Compare the hex view to the decoded text preview. If non-ASCII characters look right, the detection is correct.
About this tool
ShowHide
When a file shows up with mojibake (괆쒋쀎), the first step is figuring out what encoding it actually is. This detector reads the file's bytes in your browser (never uploaded) and runs the standard heuristics: BOM byte sequences first (FF FE for UTF-16 LE, EF BB BF for UTF-8 BOM, etc.), then null-byte density (UTF-16 has nulls in every other byte for ASCII content), then UTF-8 validity checking (most multi-byte sequences are invalid Latin-1, so valid UTF-8 = very probably UTF-8). Returns the detected encoding, confidence percentage, BOM bytes if present, and a side-by-side hex/text preview so you can sanity-check the decode visually.
Frequently asked questions
Why isn't there a 'detect' library like chardet?
Browsers don't ship chardet, and importing a large encoding-detection library (the JS port of ICU's CharsetDetector is ~200KB) for a few common cases is overkill. This tool covers the 95% case: BOMs, ASCII-only, valid UTF-8, and UTF-16 by null-byte pattern. For exotic Asian encodings (Shift_JIS, GB2312, EUC-KR) without a BOM, you'll need chardet — but this tool will tell you 'not UTF-8' so you know to look elsewhere.
What's the deal with BOMs?
Byte Order Marks are 2-4 byte prefixes that explicitly mark the encoding. UTF-8 BOM is EF BB BF (technically unnecessary, controversial — Microsoft adds them, Unix tools usually strip them). UTF-16/32 BOMs (FF FE etc.) are useful because they also signal endianness. If a file has a BOM, trust it absolutely.
The detector says UTF-8 but my file still opens wrong. What then?
Then the file is UTF-8 and the program reading it is not using UTF-8, which is a different problem with a different fix — a locale setting, an import dialogue, a database connection charset. Detection answers what the bytes are; it cannot make the next program agree. Check what the reader assumes before re-encoding anything.
How much text does a reliable answer need?
Enough to contain the characters that distinguish one encoding from another. UTF-8 can be confirmed from a single multi-byte sequence, so even a short file is decisive when it has one. A pure-ASCII file is genuinely ambiguous at any length, because it is valid in almost every encoding — and a short line with one accented character is exactly the case where a detector has to guess.
Guides on this topic
- Why Excel breaks your CSV, and how to stop itLeading zeros vanish, long order numbers lose their last digit, and product codes turn into dates. None of it is a bug: it is Excel guessing a type for every field as it opens the file.
- Why your text turns into strange charactersA name comes out as é, a Korean file becomes a wall of nonsense, or every accent is a black diamond. Text is stored as bytes and an encoding is only an agreement about what those bytes mean, so the damage tells you exactly which agreement was broken.
Related tools
Line Endings & BOM Converter
Convert between LF, CRLF, and CR line endings and add or remove a UTF-8 BOM — with per-style counts so you can see how mixed the input was.
File
Text Encoding Converter
Open text files in legacy encodings (EUC-KR, Shift_JIS, Windows-1252…) as readable UTF-8.
File
Mojibake Fixer (Repair Garbled UTF-8)
Repair text mangled by a wrong-encoding round-trip — turn café and don’t back into café and don't, automatically and in your browser.
Text
File Type Detector (Magic Bytes)
Drop a file to identify its true format from its magic bytes — and catch files whose extension or declared MIME type lies.
File
Audio Trimmer
Cut a clip out of an audio file by dragging across its waveform, add fades, and download it as a WAV. Nothing is uploaded.
File
ZIP Inspector
Drop a ZIP and see every file inside — sizes, contents, and per-file download — without unpacking it locally.
File