Skip to main content

Character Encoding Converter & Mojibake Fixer

Convert files between UTF-8, Shift_JIS and EUC-JP with encoding detection, and repair mojibake such as é or 縺薙s where the bytes survive.

Character Encoding Converter & Mojibake Fixer
Drop the file whose encoding you want to changeA text file such as CSV, TSV or TXT (up to 100 MB). The file is processed on this device, and this tool does not send it anywhere.

Nothing is uploaded.

Detects the character encoding of a text file and converts it to UTF-8, UTF-8 with a BOM, Shift_JIS or EUC-JP. Paste garbled text and the tool works backwards through the usual misreadings to suggest the original. Text that has lost bytes can only be partly recovered. Everything runs in your browser, and this tool does not send files or text anywhere.

Character Encoding Converter & Mojibake Fixer: Features

Why text turns into mojibake

Computers store text as bytes, numbers from 0 to 255, and a character encoding is the table that says which bytes stand for which character. The same letter can be stored very differently: the Japanese あ is E3 81 82 in UTF-8 but 82 A0 in Shift_JIS. If a file is read with a different table from the one it was written with, the bytes are split up and looked up wrongly, and a run of unrelated characters appears. That is mojibake. The word café saved as UTF-8 and read as Windows-1252 turns into café, and the Japanese word 文字化け read as Shift_JIS turns into 譁�ュ怜喧縺�. The � marks a byte that could not be read at all.

Converting a file

Choose a file under "Convert a file" and the tool detects its encoding and shows the first 200 lines. Check that they read correctly; if they do not, pick another encoding under "Read as". A byte order mark (BOM) or JIS escape sequences settle the encoding. Otherwise the tool checks whether the whole file is valid UTF-8, and if not, compares Shift_JIS and EUC-JP over 1 MB starting from the first non-ASCII byte to see which gives more natural Japanese. If no encoding reads everything, it picks the one that reads the most, and a file that the Japanese encodings mostly cannot read is treated as Windows-1252 (Western European). Then choose the output encoding and line endings and press "Convert and save". The converted file downloads with a suffix such as _utf8 or _sjis added to the original name. Reading and converting happen in JavaScript on this page, and this tool does not upload the file. Like every page on this site, this page also loads analytics and advertising scripts; the privacy policy has the details.

CSV files and Excel

Microsoft's support article says Excel opens a UTF-8 CSV normally if the file was saved with a BOM. A UTF-8 CSV without one can come out garbled when you simply double-click it. To open a CSV exported from a web service in Excel, convert it to "UTF-8 with BOM". For an older Japanese system that only accepts Shift_JIS, choose "Shift_JIS". Going the other way, a CSV saved from Japanese Excel in the plain "CSV (Comma delimited)" format is normally Shift_JIS, and converting it to UTF-8 makes it ready for most web services. Excel can also import a file with a chosen encoding from the Data tab, under Get Data, From File, From Text/CSV. To turn a CSV into JSON afterwards, paste the UTF-8 version into the CSV to JSON Converter.

How the mojibake repair works

Paste garbled text under "Fix mojibake" and the tool reverses the common misreadings line by line, then shows the results that read as natural text. If only some lines or words are garbled, the rest is left as it is. It tries UTF-8 read as Shift_JIS, as Latin-1 (Windows-1252), and as Latin-1 twice; Shift_JIS and EUC-JP read as Latin-1; EUC-JP read as Shift_JIS; and JIS text that lost its escape characters in an email. European text works too: São Paulo comes back as São Paulo, and Привет as Привет. How much comes back depends on the misreading. Text read as Latin-1 and percent-encoded text keep all their bytes, so they are restored in full. UTF-8 read as Shift_JIS loses bytes: they were replaced with � (or ・ or ? in some software) and are gone, so some characters do not come back. The tool narrows down which bytes could have been there from the bytes around them and the rules of UTF-8, fills in the most natural character, and underlines it. Where several characters fit equally well, it leaves a � rather than guess. EUC-JP read as Shift_JIS also loses bytes. Those are shown as � and not filled in, but because the number of lost bytes is not certain, characters next to them can come out wrong. Percent-encoded strings such as %93%FA%96%7B are decoded as UTF-8 if they are valid UTF-8, and otherwise as Shift_JIS and EUC-JP to see which one gives readable text. To inspect code points and UTF-8 bytes one character at a time, use the Unicode Converter.

Characters to watch when writing Shift_JIS

Shift_JIS cannot hold emoji, accented letters such as é, or some rarer kanji such as 𠮷. When the text contains them, the tool lists each one with the line where it first appears, and lets you replace them with ?, with 〓, or with a numeric character reference such as 😀. The wave dash is a classic trap: Macs have used 〜 (U+301C) and Windows ~ (U+FF5E) for the same Shift_JIS code, so the tool writes both to that code, and the result reads back as the Windows character. The same applies to ‖, −, —, ¢, £ and ¬. Characters such as ①, ㈱, 髙 and 﨑 are Windows additions to Shift_JIS, sometimes called vendor-specific characters, and other systems may not read them, so the tool lists any it finds. Kana stored with a separate voiced mark, as in Mac file names, cannot be written that way, so they are combined into single characters and the count is shown.

Character Encoding Converter & Mojibake Fixer: FAQ

Which encodings are supported?

Files can be read as UTF-8 (with or without a BOM), Shift_JIS, EUC-JP, JIS (ISO-2022-JP), UTF-16LE, UTF-16BE and Windows-1252, and written as UTF-8, UTF-8 with BOM, Shift_JIS or EUC-JP. Shift_JIS is handled in the form Windows uses, known as CP932 or Windows-31J, so characters such as ① and 髙 work.

Is the automatic detection always right?

Not always. Files with a BOM and files that are valid UTF-8 throughout are almost never misjudged, but a short file that reads cleanly as both Shift_JIS and EUC-JP is decided by which gives more natural Japanese, and that can be wrong. Very short EUC-JP text made only of kanji cannot be told apart from half-width katakana in Shift_JIS, so it is read as Shift_JIS. If the preview looks garbled, choose the encoding yourself under "Read as". A file of plain ASCII letters, digits and symbols is identical in UTF-8 and Shift_JIS.

Can it fix é and other mojibake in European text?

Yes, when the cause is UTF-8 read as Windows-1252 or ISO-8859-1, which is behind most of it. Paste the text under "Fix mojibake": é becomes é, ’ becomes ’, and Cyrillic, Greek and emoji come back as well. Text that went through that mistake twice, such as ãÂ, is handled too.

Why can some text not be repaired?

Bytes lost in the misreading are only filled in when the surrounding bytes narrow them down. Where several characters fit equally well, a � stays. UTF-8 read as Shift_JIS often keeps a � somewhere, for example at the full stop 。 at the end of a sentence, so a whole sentence rarely comes back perfectly. Text in Shift_JIS or EUC-JP that was read as UTF-8 cannot be recovered at all, because almost every byte was replaced with � and the original information is gone. If you still have the original file, reading it again with the right encoding under "Convert a file" is the reliable fix.

What do the underlined characters mean?

They were filled in by guessing bytes that had been lost. The tool narrows the possibilities using the neighbouring bytes and the rules of the encoding, then picks the character that makes the most natural text, but it can still be wrong. Check underlined characters against the context when it matters. Characters without an underline were read from bytes that survived. The exception is EUC-JP read as Shift_JIS, where characters next to a � can come out wrong.

Why did 〜 turn into ~?

Windows and Macs have long mapped the same Shift_JIS code, 0x8160, to different characters: ~ (U+FF5E) on Windows and 〜 (U+301C) elsewhere. Browsers follow Windows, so a 〜 written to Shift_JIS reads back as ~. Characters that were remapped this way are listed in the output section.

Can it handle large files?

Files up to 100 MB can be used. The whole file is loaded into your device's memory, so a large file may stop partway on a phone. On a large file, the check for characters that cannot be written can take a few seconds, and you can save once it has finished.

Can I change the line endings too?

Yes. Choose "CRLF (Windows)" or "LF (Mac, Linux)" under "Line endings" and every line break is written in that form. "Keep" leaves them as they are. In CSV and TSV files, line breaks inside a cell quoted with " are not changed. The line endings of the file you loaded are shown in the input section.

How to Use Character Encoding Converter & Mojibake Fixer

  1. Choose a file

    Under "Convert a file", drop the file onto the box or press "Choose a file". To repair garbled text instead, paste it under "Fix mojibake".

  2. Check how it reads

    Look at the detected encoding and the preview. If the text is garbled, choose another encoding under "Read as".

  3. Convert and save

    Choose the output encoding and line endings, then press "Convert and save" to download the converted file.

Category Encoding