What encoding turns 测试 into 娴嬭瘯?
UTF-8 → GBK UTF-8 bytes read as GBK. The six UTF-8 bytes (E6 B5 8B E8 AF 95) get regrouped into three GBK characters.
Paste garbled text and get the original back. Every plausible encoding chain — UTF-8, GBK, Big5, Shift_JIS, EUC-KR, Windows-1252 — is tried and ranked, with the exact chain shown. Free, private, runs in your browser.
Paste the garbled text. Every plausible encoding chain is tried and the results are ranked — you do not need to know which encoding broke it.
测试
UTF-8 → GBK
娴å¬ç˜¯
Windows-1252 / Latin-1 → UTF-8
测试
Windows-1252 / Latin-1 → GBK
测试
Windows-1251 → GBK
See the same text as bytes in every common encoding at once — useful when you need to know exactly what your database or protocol will store.
| Encoding | Bytes | Hex |
|---|---|---|
| UTF-8 | 6 | E4 B8 AD E6 96 87 |
| GBK | 4 | D6 D0 CE C4 |
| GB18030 | 4 | D6 D0 CE C4 |
| Big5 | 4 | A4 A4 A4 E5 |
| Shift_JIS | 4 | 92 86 95 B6 |
| EUC-KR | 4 | F1 E9 D9 FE |
Built and verified by the Go Tools engineering team.
UTF-8 → GBK UTF-8 bytes read as GBK. The six UTF-8 bytes (E6 B5 8B E8 AF 95) get regrouped into three GBK characters.
UTF-8 → Windows-1252 The same UTF-8 bytes read as Windows-1252. Because that encoding is single-byte, each of the six bytes becomes its own character.
Not recoverable No. Those bytes were discarded at decode time. Recover what you can from the surrounding text and go back to the source for the rest.
3 vs 2 bytes Three in UTF-8, two in GBK and Big5. That difference is a common source of truncation when a column is sized in bytes rather than characters.
Mojibake is what you get when text is written with one character encoding and read with another. The bytes are intact; only the interpretation is wrong. That distinction is the whole reason recovery is possible: if you can work out which encoding wrote the bytes and which one misread them, you can run the mistake backwards and get the original text.
The word is Japanese — 文字化け, roughly "character transformation" — and it became the standard term in English because the problem was endemic in Japanese computing long before Unicode. Chinese, Japanese and Korean text suffers from it far more than Latin-script text, for a structural reason: those languages need multi-byte encodings, and multi-byte encodings disagree with each other about how to group bytes. A Latin-script string is usually plain ASCII, and every encoding agrees about ASCII.
Recovery fails in exactly one situation. When a decoder meets bytes that have no meaning in its encoding, it does not keep them — it substitutes U+FFFD and throws them away. Those characters are lost permanently. Everything else is reversible.
// The mistake, in three lines of JavaScript
const bytes = new TextEncoder().encode('测试'); // UTF-8: E6 B5 8B E8 AF 95
new TextDecoder('gbk').decode(bytes); // '娴嬭瘯' ← mojibake
new TextDecoder('windows-1252').decode(bytes); // '测试' ← same bytes, other mistake Paste the garbled text and the tool enumerates the chains for you. Every combination of written-as and read-as across UTF-8, GBK, GB18030, Big5, Shift_JIS, EUC-KR, Windows-1252 and Windows-1251 is tried.
A candidate is marked Exact only when running it back through the same chain reproduces your input character for character. That is a deterministic check — a ranked guess would not tell you which results you can trust.
Each candidate names the encoding that wrote the bytes and the one that misread them. That is what you need in order to fix the source, rather than repairing the same strings again next week.
If the input already contains replacement characters, the tool says so plainly and marks every candidate as partial. Information destroyed at decode time does not come back, and pretending otherwise wastes your afternoon.
See any text as hex bytes across all supported encodings side by side, and decode raw hex in the other direction. Useful for sizing columns, reading packet captures and checking BLOB contents.
Decoding uses the browser's own TextDecoder. There is no upload, no storage and no URL rewriting — which matters because garbled text usually comes straight out of production.
娴嬭瘯
测试
The two Chinese characters were stored correctly as UTF-8 (bytes E6 B5 8B E8 AF 95), then a program read those six bytes as GBK. GBK pairs bytes two at a time, so it produced three characters instead of two. This is what you get when a UTF-8 file is opened by a legacy Windows application, or when a database connection charset is set to gbk while the data is UTF-8.
测试
测试
Same bytes, different mistake. Windows-1252 is single-byte, so each of the six UTF-8 bytes became its own character. Latin-script languages hit this version constantly: café becomes café, naïve becomes naïve. The tell-tale signs are Ã, Â, â and stray punctuation marks appearing in pairs.
B2 E2 CA D4
测试
Sometimes you are not looking at garbled text, you are looking at a hex dump from a packet capture or a BLOB column. Paste the hex into the second section and pick the encoding. B2 E2 CA D4 is 测试 in GBK — the same two characters take six bytes in UTF-8 (E6 B5 8B E8 AF 95) and cannot be represented in Windows-1252 at all.
鏁版嵁搴�
(partial only)
数据库 was written as UTF-8 and read as GBK, but the last byte pair had no meaning in GBK, so the decoder replaced it with U+FFFD. That byte is gone. The tool flags this instead of quietly guessing — you can still recover 数据 from the front of the string, but the last character is unrecoverable and you need to go back to the source data.
Drop it straight in — no need to identify the encoding first. A short fragment is enough; a dozen characters usually pins the chain down.
Exact means the chain round-trips back to your input exactly. Partial means it does not, so treat the result as a lead.
Each candidate shows which encoding the text was really written in and which one misread it. That tells you what to fix upstream, not just what the text said.
The second section shows any text as bytes in every common encoding, and decodes raw hex the other way. Use it to size columns or check protocol frames.
If a string displays correctly but you convert it anyway, you create the mojibake you were trying to avoid. Check the display first, and note that a missing font renders as boxes (□□□) while an encoding problem renders as wrong characters.
iconv -f UTF-8 -t GBK correct.txt > broken.txt
# Confirm the current encoding first file -I correct.txt # charset=utf-8 → nothing to convert
Changing a MySQL column's declared charset does not re-encode the bytes it holds. Declaring latin1 data as utf8 makes the server hand back bytes that are not valid UTF-8, and the driver replaces them with U+FFFD — which destroys them.
ALTER TABLE t MODIFY c VARCHAR(255) CHARACTER SET utf8mb4;
-- Go via a binary type so the bytes are preserved, not reinterpreted ALTER TABLE t MODIFY c VARBINARY(255); ALTER TABLE t MODIFY c VARCHAR(255) CHARACTER SET utf8mb4;
A candidate marked Partial did not round-trip. It is a lead worth following, not an answer to paste back into your database. If nothing comes back Exact, the input probably lost information already — go back to the source bytes.
// Take the first candidate whatever the badge says db.update(row.id, candidates[0].text);
// Only write back what round-trips if (candidates[0].lossless) db.update(row.id, candidates[0].text);
Calling encode on something that is already bytes, or decode on something already a string, raises in Python 3 rather than silently doing a round trip through ASCII. Decode bytes once, at the boundary, and keep text as text after that.
text = raw.decode('utf-8').encode('gbk').decode('utf-8') # Decode once at the boundary, with the encoding the file actually uses
with open(path, encoding='gbk') as f:
text = f.read() iconv -f GBK -t UTF-8 input.txt > output.txt on macOS or Linux, or Get-Content -Encoding Default in.txt | Set-Content -Encoding UTF8 out.txt in PowerShell. Paste a representative line here first to work out which encodings to name in the command — getting the direction wrong on a whole file is how one-line problems become thousand-line problems. Encoding & Formatting
The full ASCII table: 128 characters in decimal, hex, octal and binary, plus a two-way text-to-ASCII converter. Control characters come with escape sequences, caret notation and where you actually meet them.
Encoding & Formatting
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
Encoding & Formatting
Decode a Base64 string or data URI back into an image in your browser. Preview, read dimensions & MIME, then download as PNG, JPG, GIF, SVG. No upload.
Encoding & Formatting
Convert CSV to JSON in your browser. RFC 4180, type inference, header row, big-int safe. 100% private, no upload.
Encoding & Formatting
Paste a .env file, get JSON instantly. Your database passwords, API keys and tokens never leave your browser — 100% private, no upload, free dotenv parser.
Encoding & Formatting
Decode HTML entities and unescape HTML online — free, no signup, 100% in your browser. Converts named, decimal & hex references back to characters; never uploaded.