Character Encoding Converter (UTF-8 / GBK Conversion, Encoding Detection and Chinese Garbled Text Repair)

Detection is heuristic: BOM first, then pure ASCII, then a strict UTF-8 decode, and only after that a GBK probability check. Browsers cannot determine an encoding with 100% certainty.
Output encoding: — Bytes: — Characters: 0
Quick fix
Typical garbled text: a run of CJK characters means UTF-8 bytes were read as GBK, while accented Latin letters mean GBK bytes were read as single bytes. Use the buttons above to restore the original text.
What the browser can really do: UTF-8 and UTF-16 are decoded natively, GBK and GB2312 are handled by the built-in decoders, and the UTF-8 to GBK byte direction uses a lookup table built locally by this tool (no library is downloaded). Characters outside GBK raise a clear error instead of being dropped silently. UTF-32 is encoded and decoded by hand so astral characters keep their real code points.
Every conversion runs locally in your browser. Your input is never uploaded to any server and no account is required.

Character Encoding Converter (UTF-8 / GBK Conversion, Encoding Detection and Chinese Garbled Text Repair): Inspect Bytes and Unicode Code Points, Detect Encodings, and Repair Garbled Text Locally

How does the character encoding converter work? Inspect bytes, identify encodings, and repair garbled text

A character encoding converter converts text between different character encodings while displaying UTF-8 bytes and Unicode code points.

Select the source and target encodings to convert the text. If you do not know the original encoding, run detection first. All processing takes place locally in the browser.

Three common causes of Chinese garbled text

The first is reading UTF-8 bytes as GBK, which commonly produces combinations such as “浣犲ソ”. The second is reading GBK bytes as a single-byte encoding, producing combinations of Latin characters and symbols. The third is a BOM at the beginning of a byte stream that the receiver does not interpret according to the indicated encoding. The diagnostic method is straightforward: identify the appearance of the garbled text and then use the corresponding reverse conversion.

The essential differences between UTF-8, GBK, UTF-16, and UTF-32

UTF-8 is a variable-length encoding that uses 1 to 4 bytes per character. English uses 1 byte and common Chinese characters use 3 bytes, making UTF-8 the de facto standard for web pages and APIs. GBK and GB2312 are double-byte Chinese encodings commonly found in Chinese-language environments and legacy systems. UTF-16 and UTF-32 use wider character representations; UTF-16 is common in Windows internals and some file formats, while UTF-32 makes code-point calculations more direct at the cost of larger data size. Because different encodings produce different byte sequences for the same text, bytes do not have a unique text interpretation without encoding information.

Why can encoding detection provide only candidates and confidence?

A byte sequence usually does not contain its own encoding declaration. Detection therefore relies on rules and trial decoding: first checking for a BOM, then determining whether all bytes are ASCII, validating strict UTF-8 decoding, and finally checking whether GBK decoding produces plausible Chinese text. This covers many common cases, but short text and symbol-only text can legitimately match multiple encodings. The tool therefore provides candidate encodings, confidence, and reasoning rather than an absolute conclusion.

Why can UTF-8 and GBK not be converted arbitrarily?

UTF-8 represents far more characters than GBK. GBK covers Chinese characters and a subset of symbols, so characters not represented by GBK, such as common Emoji and some rare characters, cannot be encoded into GBK bytes. In such cases, this tool reports the unsupported character instead of silently discarding it. Converting GBK text to UTF-8 generally does not have this limitation because UTF-8 has broader character coverage.

What are byte sequences and Unicode code points used for?

A byte sequence is the actual representation stored in files and transmitted over networks. It is essential when troubleshooting garbled text, checking APIs, or comparing database fields. A Unicode code point, such as U+4F60, is the identifier of a character and does not depend on the encoding method. It is therefore useful for determining whether two characters are actually the same. The tool shows both views so they can be cross-checked.

What can this tool do, and what can it not do?

It supports conversion between UTF-8, GBK, GB2312, UTF-16LE/BE, and UTF-32LE/BE, byte and code-point inspection, encoding detection, and one-click repair of two common types of garbled text. It does not guess an encoding without sufficient evidence, translate or correct text, or process binary files and images. UTF-8 and UTF-16 use browser-native decoding, while GBK and GB2312 use browser-supported decoders. UTF-8 to GBK byte output uses a local character table and does not download a third-party library. All conversion runs locally in the browser, and your input is not uploaded to the server.

Can Chinese garbled text be repaired directly? First identify the type of garbling.

Garbled text does not necessarily mean the characters were damaged. It often means that the same bytes were decoded using the wrong encoding. Reading UTF-8 bytes as GBK can produce combinations such as “浣犲ソ”, while reading GBK bytes as a single-byte encoding can produce Latin characters and symbols. Once the cause is known, the corresponding reverse conversion can restore the text.

If the original encoding is completely unknown, paste the hexadecimal byte sequence and use encoding detection to obtain candidate encodings and the reasoning behind them before choosing the conversion direction.

  • Bytes and Unicode code points are displayed together, making it easier to determine whether two characters are actually the same.
  • Encoding detection uses four steps: BOM, pure ASCII, strict UTF-8 decoding, and GBK probability, providing candidates and confidence.
  • Supports conversion between UTF-8, GBK, GB2312, UTF-16LE/BE, and UTF-32LE/BE.
  • Provides one-click repair for two common types of garbled text: UTF-8 bytes interpreted as GBK and GBK bytes interpreted as a single-byte encoding.
  • When the target character set cannot represent a character, the tool reports the character instead of silently discarding it.
  • All conversion runs locally in the browser, your input is not uploaded to the server, and no registration is required.
For Base64, URL, or Hex text encoding, use the text encoding converter. For number-base and byte-level calculations, use the number base converter.
Comments 0
No comments yet. Be the first to comment!
avatar
Comment content cannot be empty
0/255