GB18030 Encoding Rules Cheat Sheet
Enter a short text, then use WHATWG Web-compatible GB18030 to look up the actual bytes and one-, two-, or four-byte type, while preserving the encoding rules quick reference.
How to use GB18030 encoding rules quick reference
GB18030 bytes are calculated in the current browser using local fixed indexes and range tables; no text is uploaded.
Enter short text
Enter at most 64 Unicode scalar values; the tool processes each character in the original order.
View byte type
View uppercase hexadecimal bytes character by character, distinguishing ASCII single bytes, indexed double bytes, and range-mapped four-byte sequences.
Verify the encoding rules
Single-character lookup links to the rule explanation; you can copy TSV or clear it, and unsupported items will not be masked by replacement characters.
Limitations and Notes
- The lookup uses the fixed GB18030 indexes and range tables of WHATWG Encoding and incorporates GB18030-2022 Web compatibility updates; it is not a complete standards-compliance validator.
- The output represents only the encoding bytes of a single Unicode scalar and does not include files, BOM, transport encapsulation, or decoding state.
- The WHATWG encoding algorithm explicitly excludes U+E5E5; it will be shown as “unsupported”; the tool will not replace the original character with a question mark or U+FFFD.
FAQ
Why does an emoji produce a four-byte result?
GB18030 uses a range algorithm to generate four-byte sequences for many Unicode scalars that do not fall within the two-byte index.
Why are the GB18030 and GBK bytes of some characters identical?
GB18030 inherits many two-byte mappings, but also adds four-byte ranges; the same result does not mean that the two encodings are completely equivalent.
Can this tool determine whether a file conforms to GB18030-2022?
No. This is a character-by-character encoding lookup; it does not check complete byte streams, invalid sequences, declaration tags, or other compliance requirements of the standard.