Unicode is a computing industry standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. It assigns a unique numeric code point to every character, such as U+4E2D for the Chinese character "δΈ". As of Unicode 15.0, over 140,000 characters have been defined, covering virtually all known writing systems.
Unicode defines the character set (unique numbers for each character), while UTF-8 (Unicode Transformation Format - 8-bit) is an encoding scheme that converts Unicode code points into byte sequences. UTF-8 uses variable-length encoding: ASCII characters take 1 byte, common scripts take 2-3 bytes, and supplementary plane characters take 4 bytes. UTF-8 is the most widely used encoding on the web and is backward-compatible with ASCII.
In programming, Unicode characters often appear as escape sequences. JavaScript uses \u4E2D for BMP characters and \u{20BB7} for supplementary plane characters (ES6+). Python uses \u4E2D (4-digit) and \U00020BB7 (8-digit). CSS uses \4E2D. HTML entities use 中 (decimal) or 中 (hex). This tool supports all of these formats for both encoding and decoding.
This Unicode encoder and decoder is straightforward yet powerful. Here is a detailed guide:
Text to Unicode Escape: Enter any text in the input field (supports Chinese, Emoji, and all Unicode characters), select the "Text β Unicode Escape" mode, and click "Convert". The tool converts each character to its corresponding \uXXXX format. For supplementary plane characters (such as Emoji), it automatically uses the \u{XXXXXX} format. The result area shows the converted Unicode escape string.
Unicode Escape to Text: Paste a Unicode escape string (e.g., \u4e2d\u6587) into the input field, select "Unicode Escape β Text" mode, and click "Convert" to restore the original text. The tool automatically recognizes both 4-digit and 6-digit (with braces) formats, and supports mixed input. If the escape sequence format is incorrect, the tool will show an error message.
HTML Entity Encoding and Decoding: Select "Text β HTML Entity" mode to convert each character into a decimal HTML entity (e.g., 中). For reverse conversion, select "HTML Entity β Text" mode. Both decimal and hexadecimal HTML entity formats are supported. This is useful for web security escaping and XSS prevention.
UTF-8 Byte Conversion: Select "Text β UTF-8 Bytes" mode to display the UTF-8 byte sequence for each character (hexadecimal notation, e.g., E4 B8 AD). For reverse conversion, the tool supports multiple delimiter formats including spaces, commas, and 0x prefixes. This is helpful for analyzing character encoding and debugging encoding issues.
Batch Conversion: The tool supports batch conversion of large text blocks. After entering long text, the tool processes it character by character and shows the full result in the output area. Use the "Copy Result" button to save the result to your clipboard.
Unicode encoding conversion is widely used in web development, data processing, and internationalization projects. Here are several practical scenarios:
JavaScript String Escaping: When working with JavaScript strings containing non-ASCII characters, converting them to Unicode escape sequences ensures encoding safety and JSON compatibility. For example, converting "Chinese test" to "\u4e2d\u6587\u6d4b\u8bd5" guarantees correct display across different encoding environments. This tool provides one-click conversion for this task.
HTML Entity Encoding: In web development, encoding special characters and international characters as HTML entities is essential for XSS prevention. For example, converting <script> to <script> effectively prevents code injection attacks. This tool supports batch HTML entity encoding and decoding.
Encoding Troubleshooting: When dealing with text from different sources, encoding mismatches often cause garbled characters. By converting garbled text to UTF-8 byte sequences, you can visually inspect the actual bytes and determine whether the issue stems from incorrect encoding detection, missing BOM markers, or byte-order problems. This tool's UTF-8 byte conversion helps quickly pinpoint encoding issues.
Emoji Handling: Emoji characters extend beyond the Basic Multilingual Plane (BMP) and require surrogate pairs or the \u{XXXXXX} format. This tool fully supports encoding and decoding of all Unicode Emoji, including the latest Emoji 15.0 characters. Developers can use this tool to verify Emoji correctness across different encoding formats.
Unicode Planes and Blocks: Unicode organizes its character space into 17 planes, each containing 65,536 code points. Plane 0 (BMP, U+0000 to U+FFFF) contains the most commonly used characters, including basic Latin letters and CJK unified ideographs. Planes 1-2 contain historic scripts and symbols, planes 3-13 are unassigned, plane 14 is for special purposes, and planes 15-16 are private use areas. Emoji characters are located primarily in plane 0 (basic Emoji) and plane 1 (extended Emoji).
UTF-8 Encoding Rules: UTF-8 is a prefix code that uses high-order bits to identify character length. Single-byte characters start with 0 (0xxxxxxx), multi-byte characters start with 110, 1110, or 11110, and continuation bytes start with 10. For example, the Chinese character "δΈ" (U+4E2D) encodes to E4 B8 AD in UTF-8, which is binary 11100100 10111000 10101101. This design gives UTF-8 self-synchronizing properties, meaning character boundaries can be identified even when starting from the middle of a stream.
BOM (Byte Order Mark): UTF-8 files sometimes include a BOM (EF BB BF) at the beginning to identify the file as UTF-8 encoded. While the BOM does not affect byte order in UTF-8 (since UTF-8 is byte-order independent), certain systems such as Windows Notepad automatically add it. On Unix/Linux systems, a BOM can cause script execution errors (extra bytes at the start of a shebang line). This tool allows you to choose whether to include a BOM during conversion.
Unicode is a character set (assigning unique numbers to every character), while UTF-8 is an encoding scheme (converting Unicode code points into byte sequences). UTF-8 is one implementation of Unicode, using 1-4 bytes per character and remaining backward-compatible with ASCII.
They are related but not identical. HTML entities such as 中 represent the Unicode character with code point 20013. Unicode escapes like \u4e2d also represent the same character, just in a different format.
Yes. This tool fully supports Emoji encoding and decoding, including supplementary plane characters represented via surrogate pairs.
No. All conversions run entirely within your browser. Your data never leaves your device, ensuring complete privacy.
The tool runs locally in your browser and theoretically supports tens of thousands of characters. For the best performance, we recommend processing no more than 10,000 characters at a time.
Both JavaScript and Python use \u followed by four hex digits for BMP characters (U+0000 to U+FFFF). JavaScript also supports \u{xxxxxx} for supplementary plane characters (ES6+), while Python 3 uses \U000xxxxx. This tool supports both formats.
UTF-8 uses variable-length encoding: ASCII characters take 1 byte (U+007F and below), common CJK characters take 3 bytes (U+0800 to U+FFFF), and supplementary plane characters take 4 bytes. Most Chinese characters fall within U+4E00 to U+9FFF, so they encode to 3 bytes in UTF-8.
A BOM is a special marker placed at the start of UTF-8 or UTF-16 files (EF BB BF for UTF-8) to identify the encoding and byte order. Some systems require a BOM to correctly identify UTF encoding, though most modern applications can auto-detect it.