Skip to content
⚠ TESTING ENVIRONMENT You are viewing a testing copy of Tolioo. Changes here do not affect the live website.

Text Encoding Detector

Find out whether a file is UTF-8, UTF-16, Windows-1252, Windows-1256 and more, preview it in any encoding, convert it to UTF-8 and repair garbled text (mojibake).

  • 100% free
  • No Signup
  • Files never uploaded
Your Privacy Matters

Detection and conversion run entirely inside your browser. Your files and text are never uploaded, sent to a server or stored.

ADVERTISEMENT
Demo Ad 728 x 90

How to detect text encoding

1Add your file or text

Drop a text file, or paste text that looks broken.

2Review the match

See the best encoding, its likelihood and a live preview.

3Convert or repair

Download clean UTF-8 or copy the repaired text.

TEXT ENCODING GUIDE

Text Encoding Detector – Detect File Encoding, Fix Garbled Text and Convert to UTF-8 Online Free

Opened a file and found strange symbols like é, ’, question marks or black diamonds instead of readable text? Then you are looking at an encoding problem, and this free text encoding detector helps you solve it in seconds. Upload a file and the tool inspects its raw bytes to tell you whether it is UTF-8, UTF-8 with BOM, UTF-16, UTF-32, ASCII, Windows-1252, Windows-1251, Windows-1256 for Arabic and Urdu, ISO-8859, KOI8, Shift_JIS, GBK, Big5 or EUC-KR. You get a ranked list of possible encodings with a relative likelihood, a live preview in any encoding you pick, a hex view of the first bytes and a one click download that converts the file to clean UTF-8. A second mode repairs garbled text that you paste, a problem known as mojibake, by reversing the wrong decoding step. It works as a character encoding checker, a file encoding detector, a UTF-8 validator, a charset detector and an encoding converter in one page. There is no signup, no software to install and nothing is uploaded: your files are read locally by your browser, so private documents, CSV exports, subtitles and database dumps stay on your device.

Detect File Encoding

Find the character encoding of any text file: TXT, CSV, HTML, XML, JSON, SQL, SRT subtitles, log files and more. The detector checks for a byte order mark, validates UTF-8, looks for UTF-16 patterns and scores legacy code pages.

Fix Garbled Text (Mojibake)

Paste text such as café or “quotes†and the repair mode reverses the wrong decoding to bring back café and “quotes”. It even handles text that was encoded twice, and it works for Latin, Cyrillic, Arabic and other scripts.

Convert File to UTF-8

Once the preview looks right, download the file as UTF-8, with or without a BOM. UTF-8 is the safest encoding for websites, databases, APIs, source code and sharing files between different systems and countries.

BOM and Byte Order Check

See at once whether your file starts with a UTF-8, UTF-16 or UTF-32 byte order mark. The BOM explains many mysterious problems, such as strange characters at the start of a CSV or a PHP script that outputs headers too early.

Arabic, Urdu, Hindi and Asian Text

Legacy files in Windows-1256, Windows-1251, Shift_JIS, GBK, Big5 and EUC-KR are a common source of broken text. The preview lets you test several encodings until the real language appears.

Hex View and File Facts

Inspect the first bytes of the file in hexadecimal, together with its size, line endings, ASCII status and UTF-8 validity. These facts help developers and data engineers understand exactly what is inside a mysterious file.

What Is Text Encoding?

Computers store everything as numbers, so every letter you type has to be turned into bytes when it is saved, and turned back into a letter when the file is opened. A text encoding, also called a character encoding or charset, is the rulebook for that translation. The letter A, the Urdu letter ب, the euro sign and an emoji all need an agreed number and an agreed way to write that number as bytes. If the program that writes the file and the program that reads it use different rulebooks, the numbers are translated into the wrong characters and you see garbled text.

In the early days each language area created its own encoding, which is why there are dozens of legacy code pages such as Windows-1252 for Western Europe, Windows-1251 for Cyrillic and Windows-1256 for Arabic. Unicode was created to give every character in every language one unique number, and UTF-8, UTF-16 and UTF-32 are different ways of storing those numbers as bytes. Today UTF-8 is used by the vast majority of web pages and is the recommended default for new files, but old files, exports from legacy software and data from older systems are still full of other encodings.

Common text encodings and where you meet them
Encoding Covers Bytes per character Typical use
ASCII English letters, digits and basic symbols (128 characters) 1 Plain English text, source code, configuration files
UTF-8 All of Unicode 1 to 4 Websites, APIs, databases, modern files
UTF-16 (LE / BE) All of Unicode 2 or 4 Windows internals, Java and .NET strings, some exports
UTF-32 (LE / BE) All of Unicode 4 Rare, mostly in memory
Windows-1252 (Latin-1) Western European languages 1 Old Windows documents, legacy CSV and HTML
Windows-1251 Russian, Ukrainian, Bulgarian and other Cyrillic languages 1 Legacy Cyrillic files and databases
Windows-1256 Arabic and many Urdu and Persian letters 1 Legacy Arabic and Urdu documents and exports
Shift_JIS, EUC-JP Japanese 1 or 2 Older Japanese software and websites
GBK, Big5 Simplified and Traditional Chinese 1 or 2 Older Chinese software and websites
EUC-KR Korean 1 or 2 Older Korean software and websites

Why Does Text Look Garbled? Understanding Mojibake

The strange text that appears when a file is opened with the wrong encoding is called mojibake, a Japanese word that means "character transformation". It is one of the most common problems when you open CSV files from other countries, import old databases, read emails and web pages with a wrong charset, or copy text between systems. The pattern of the garbage is a clue: the same wrong step always produces the same kind of mess, so you can often tell the cause just by looking at it.

What the garbled text tells you
What you see What it should be Likely cause
café, naïve café, naïve UTF-8 text opened as Windows-1252 or Latin-1
’ “ †’ “ ” UTF-8 curly quotes and dashes read as Windows-1252
Привет Привет UTF-8 Cyrillic read as Windows-1252
السلام Arabic or Urdu letters UTF-8 Arabic script read as Windows-1252
Black diamonds with question marks The original letters Invalid bytes replaced by U+FFFD, often a legacy file read as UTF-8
Rows of question marks Non-English text Characters could not be converted when the file was saved, so the data is already lost
Letters with spaces or null symbols between them Normal text UTF-16 file read as ASCII or UTF-8
 at the start of a file Nothing (invisible) UTF-8 BOM read as Windows-1252

An important detail: if the broken text contains question marks or the replacement diamond, the original information may already be gone, and no tool can restore it from the pasted text alone. In that case you should go back to the original file and open it again with the correct encoding, which is exactly what the file detector tab is for.

How to Detect the Encoding of a File (Step by Step)

Finding the encoding of a file used to require command line tools or a programmer's text editor. With this online file encoding detector the process takes a few seconds.

  1. Select the "Detect file encoding" tab: This is the default view.
  2. Drop your file: Drag a TXT, CSV, HTML, XML, JSON, SQL, SRT or any other text based file into the box, or click Select file.
  3. Read the best match: The tool shows the most likely encoding with a relative likelihood and a short explanation of why.
  4. Compare other candidates: Click any encoding in the list. The preview changes at once, so you can see which one shows real words in the right language.
  5. Convert if needed: Click Download as UTF-8 to get a clean copy, with an optional BOM for older versions of Excel.

Always trust your eyes in the preview. If the preview shows readable words in the language you expect, you have found the right encoding, whatever the percentage says.

How Does Encoding Detection Work?

Plain text files do not carry a label that says which encoding they use, so detectors rely on evidence in the bytes. The evidence comes in layers, from the most reliable to the least reliable. Knowing the layers also explains why a result is sometimes marked as uncertain.

  • Byte order mark (BOM): A few special bytes at the very start of a file announce UTF-8, UTF-16 or UTF-32. When a BOM exists it is the strongest sign.
  • UTF-8 validity: UTF-8 has strict rules about how multi byte characters are built. Legacy text that contains accented or non-Latin letters almost never follows those rules by accident, so a file that passes the UTF-8 check is very likely UTF-8.
  • Zero byte patterns: English text saved as UTF-16 has a zero byte next to nearly every letter. The position of the zeros shows whether the file is little endian or big endian.
  • Pure ASCII: If every byte is below 128, the file is plain ASCII, which is also valid UTF-8 and valid in almost every other encoding.
  • Statistical plausibility: For single byte legacy encodings and Asian multi byte encodings, the file is decoded with many candidates and each result is scored. Natural text has consistent letters from one script, few control characters and no replacement characters, and the candidate that produces the most natural text ranks first.

The last layer is a best guess, not a proof. Many single byte encodings use the same bytes for different letters, so a short Russian text can be a perfectly reasonable Windows-1251 or KOI8-R document. That is why this tool shows several candidates and lets you verify the answer in a preview.

BOM Explained: UTF-8 With BOM, UTF-16 LE and BE

A byte order mark is a small signature at the start of a file. For UTF-16 and UTF-32 it tells the reader whether the bytes of each character are stored with the most significant byte first (big endian) or last (little endian). For UTF-8 the order of bytes does not change, so a BOM is optional and only serves as a hint that the file is UTF-8. Some programs add it, and some programs are confused by it.

Byte order marks and what they mean
Encoding BOM bytes (hex) Notes
UTF-8 with BOM EF BB BF Helps older Excel recognize UTF-8 in CSV files, but can break scripts, JSON parsers and shell files
UTF-16 LE FF FE Common in files saved as "Unicode" by Windows programs
UTF-16 BE FE FF Used by some Java and Mac based tools
UTF-32 LE FF FE 00 00 Rare
UTF-32 BE 00 00 FE FF Rare

If a web page, PHP file or configuration file behaves strangely, check it for a stray UTF-8 BOM. The invisible bytes at the start can be sent to the browser as content, can break the "headers already sent" rule in PHP and can add an unexpected character to the first value of a JSON or CSV file.

How to Fix Garbled Text Online

If you only have the broken text, for example from an email, a database field or a web page, switch to the "Fix garbled text" tab and paste it. The repair mode assumes that the text was originally UTF-8, that it was then wrongly read with a single byte encoding, and that the result was saved. It reverses the wrong step: it turns the strange characters back into the bytes they came from, using the candidate encoding as a map, and then reads those bytes correctly as UTF-8. The tool tries Windows-1252 first, then Cyrillic, Arabic, Central European, Greek, Turkish, Hebrew, KOI8-R and Mac Roman, and it repeats the process up to three times for text that was damaged more than once.

  • Only suggestions that clearly improve the text are shown: Each repaired version is scored, and results that are not more natural than the original are discarded.
  • Several suggestions can appear: Read them and copy the one that shows real words in the right language.
  • No suggestion means no safe repair: The text may be fine, may be damaged in another way, or may have lost characters already.
  • Prefer the original file when you have it: Detecting the encoding of the source file is always more reliable than repairing a copy.

CSV Files, Excel and Encoding: The Classic Problem

CSV files are the number one source of encoding questions. A CSV is just text, so it can be saved in any encoding, but Excel guesses the encoding when you double click the file, and the guess is often wrong. A UTF-8 CSV with names such as José, Müller or محمد can show up with broken letters, while a Windows-1252 CSV opens fine. The reverse problem also exists when a program expects UTF-8 and receives a Windows-1252 file.

  • Excel shows broken accents or Arabic letters: Convert the file to UTF-8 with BOM using the download option, or import it through the Data menu and choose UTF-8 as the file origin.
  • A database import fails or stores strange letters: Check the file encoding first and convert it to the encoding that the database or import tool expects.
  • The first column name contains odd characters: The file probably has a UTF-8 BOM that the importer does not remove. Download a copy without the BOM.
  • The delimiter or line endings cause errors: Check the line endings shown in the file facts and normalize them if necessary.

Encoding Problems on Websites, HTML and Databases

On the web the encoding must be declared and used consistently from end to end: the file on the server, the HTTP header, the HTML meta tag, the database connection and the database tables. A single weak link is enough to produce garbled text. The most reliable setup is UTF-8 everywhere.

  • HTML: Put <meta charset="utf-8"> near the top of the head, and make sure the file itself is saved as UTF-8.
  • HTTP headers: The Content-Type header can include charset=utf-8 and takes priority over the meta tag in many cases.
  • MySQL and MariaDB: The old "utf8" character set stores only three bytes per character and cannot hold emoji. Use utf8mb4 for full Unicode, and set the connection charset as well.
  • Programming languages: Specify the encoding when you open files, for example in Python, Java or PHP, instead of relying on the system default.
  • Mixed content: A UTF-8 page that includes a Windows-1252 script or text file can show broken characters in only one part of the page.

Arabic, Urdu, Persian, Hindi and Other Non-Latin Text

Languages that do not use the basic Latin alphabet suffer the most when encodings go wrong. Old Arabic and Urdu systems used Windows-1256 or other code pages, and files from those systems appear as unreadable symbols or question marks in a UTF-8 application. Hindi and other Indic languages have a history of custom fonts that look correct only with one particular font installed. Today the right solution is to store such text as UTF-8, which supports all of these scripts in one file and displays them correctly in browsers, phones and office programs.

  • Legacy Arabic or Urdu file looks broken: Upload it here and test Windows-1256 in the preview. If the real language appears, download the UTF-8 version.
  • Urdu text shows as الس...: Paste it in the repair tab. It is UTF-8 that was wrongly read as Windows-1252 and can usually be reversed.
  • Text turned into question marks: The characters were lost during conversion. Go back to the original source and export it again in UTF-8.
  • Right to left display problems: If the letters are correct but the order looks wrong, the issue is text direction rather than encoding.

Who Uses a Text Encoding Detector?

  • Developers and DevOps engineers: Check source files, logs, configuration files and API samples before deployment or migration.
  • Data analysts and database administrators: Make sure CSV and SQL files are in the expected encoding before importing.
  • Web designers and SEO specialists: Track down broken characters in titles, descriptions and page content.
  • Translators and subtitle editors: Fix SRT and text files that show broken accents or non-Latin letters.
  • Office users and students: Open old documents, exports and downloaded text files that do not display correctly.
  • Security and forensics learners: Identify hidden byte patterns, BOMs and unusual encodings in samples.

Troubleshooting: Common Encoding Problems and Fixes

Encoding troubleshooting guide
Problem Likely cause What to do
Detector says ASCII, but the text is not English The file contains only 7-bit characters, so the non-English text is already damaged or replaced Export again from the original source in UTF-8
Two or more encodings have similar likelihood Single byte encodings share many byte values Select each one and judge the preview by eye
Preview shows many replacement characters Wrong encoding chosen, or the file is binary Try other candidates, or check that the file really is text
File contains many null bytes UTF-16 or UTF-32 file, or a binary file Check the UTF-16 candidates
Converted file still looks wrong in Excel Excel did not recognize UTF-8 without a BOM Tick "Add UTF-8 BOM" before downloading
Repair tab shows no suggestions Text is not mojibake, or characters are already lost Use the original file in the detect tab

Best Practices to Avoid Encoding Problems

  • Use UTF-8 for everything new: Files, databases, APIs, web pages and source code should all use UTF-8.
  • Declare the encoding explicitly: Use charset headers, meta tags, database connection settings and file open parameters, and do not rely on defaults.
  • Keep the original file: Before converting, save a copy, so that you can try another encoding if the first conversion is wrong.
  • Convert once: Converting the same text repeatedly with a wrong source encoding is how double encoded text is created.
  • Use a BOM only when needed: Add it for CSV files that must open correctly in older Excel, and leave it out for code, JSON and shell scripts.
  • Test with real characters: Include accented letters, non-Latin text and an emoji in your tests, not only plain English.

Free, Private and Instant Character Encoding Checker

This text encoding detector works on Windows, Mac, Linux, Android and iPhone in any modern browser. Your file is read locally with the browser's own decoding functions, so nothing is uploaded and no one else can see it. Bookmark this page and use it whenever a file shows strange characters, when you need to know whether a file is UTF-8 or Windows-1252, when you have to convert a legacy file to UTF-8 or when you want to repair text that looks like mojibake.

Ready to try it? Drop your file above, or paste your garbled text in the repair tab, and see the real content appear. If you also need to clean spaces, convert line breaks or analyze characters, explore the other free text tools on our site.

ADVERTISEMENT
Demo Ad 300 x 250
COMMON QUESTIONS

Text Encoding Detector FAQ

Quick answers about finding a file's encoding, fixing garbled characters and converting to UTF-8.

How do I find the encoding of a text file?

Drop the file into the detector. The tool checks for a byte order mark, tests whether the bytes are valid UTF-8, looks for UTF-16 patterns and scores common legacy encodings. It shows the best match with a relative likelihood and lets you preview the file in any candidate encoding to confirm the answer by eye.

Why does my text show characters like é, ’ or question marks?

This is mojibake, caused by reading text with a different encoding than the one used to write it. Characters like é usually mean UTF-8 text was read as Windows-1252. Question marks or black diamonds can mean the original characters were lost or replaced. Use the "Fix garbled text" tab to try to reverse the wrong step.

What is the difference between UTF-8, UTF-16 and Windows-1252?

UTF-8 and UTF-16 can both store every Unicode character, but UTF-8 uses one to four bytes and is the standard on the web, while UTF-16 uses two or four bytes. Windows-1252 is an older single byte encoding for Western European languages that can store only 256 characters. Only the Unicode encodings can mix many scripts in one file.

How do I convert a file to UTF-8?

Upload the file, select the encoding whose preview shows correct text, and click Download as UTF-8. Tick the BOM option if the file must open correctly in older versions of Excel. For code, JSON and shell scripts it is better to leave the BOM out.

Can encoding detection ever be 100% accurate?

Not always. A BOM or a valid multi byte UTF-8 sequence gives strong evidence, but many single byte encodings use the same bytes for different letters, and a short text can fit several of them. That is why the tool shows a ranked list and a live preview, so you can confirm the right encoding by checking that the text is readable.

Can it fix Arabic, Urdu or Russian text that shows as strange symbols?

Often, yes. If the file is a legacy Windows-1256 or Windows-1251 file, upload it, select that encoding in the preview and download the UTF-8 version. If you only have pasted text that was UTF-8 read as Windows-1252, the repair tab can usually restore it. If the text already became question marks, the original characters are gone and you need the source file.

Is it safe to upload my file, and is there a size limit?

Your file is never uploaded. It is read and analyzed inside your browser and disappears when you close the page. The tool accepts files up to 50 MB, and for very large files it analyzes the first part of the file for speed. As a general habit, avoid handling highly sensitive data on any website you do not fully trust.

ADVERTISEMENT
Demo Ad 320 x 50

All Tools, One Place

Merge, split, compress and convert files in seconds. Explore powerful free tools for all your everyday needs.

Explore All Tools →