TToolbox
U+

Unicode Converter

Convert text to Unicode code points

About this tool

Unicode (Universal Coded Character Set, ISO/IEC 10646) assigns a unique numerical Code Point to every character across modern and historical languages worldwide. During cross-platform data interchange, web scraping, and JavaScript source code deobfuscation, developers constantly encounter representations like `\u4e2d\u6587` (JS/Java escapes), `U+4E2D` (Hex code points), or `中` (HTML entities). This tool provides bidirectional translation between plain text and Unicode code points locally.

How to Use This Tool (Step-by-Step)

1

Enter Plain Text or Unicode String

Paste your readable text, emoji, or raw escaped strings containing `\uXXXX` escape sequences into the workspace.

2

Select Transcoding Mode

Select 'Text to Unicode' (supports `\u` escapes, `U+` hex points, CSS slashes) or 'Unicode to Text' to decode.

3

Inspect Code Points & Copy Output

The converted string renders instantly with UTF-8 / UTF-16 byte breakdowns. Copy output with a single click.

Full Escape Syntax Suite

Supports JavaScript/Java `\uXXXX`, modern ES6 variable-length `\u{XXXXX}`, and C/C++ 32-bit `\UXXXXXXXX` notations.

Surrogate Pair & Supplementary Plane Support

Handles supplementary plane characters above U+FFFF (complex CJK ideograms, emojis) with automatic surrogate pair resolution.

100% Client-Side Air-Gapped

Calculations run exclusively inside your browser runtime. Proprietary text strings and tokens remain completely secure.

Unicode vs UTF-8 Architecture & Encoding Tips

  • •Unicode vs UTF-8: Unicode is the abstract character map (assigning code points like U+4E2D). UTF-8 is the physical byte serialization protocol.
  • •Decoding scraped `\uXXXX` strings: Scraped JSON frequently escapes Chinese text. In Python, run `.encode('utf-8').decode('unicode_escape')` to restore plain text.
  • •UTF-16 string length quirk: Characters above U+FFFF use surrogate pairs, registering as length 2 in JS. Always measure length via `Array.from(str).length`.

Code & Transformation Examples

Multilingual Unicode Escape Syntax Benchmark

Original Chinese Input
世界你好
Unicode Representations
• JavaScript / Java 格式 : \u4e16\u754c\u4f60\u597d
• 国际标准码点表示       : U+4E16 U+754C U+4F60 U+597D
• HTML 数字十进制实体    : 世界你好
• CSS 伪类 content 转义  : \4E16\754C\4F60\597D

* Each 4-digit hexadecimal block maps to the definitive international character code point.

JavaScript Unicode Conversion Snippet

Text to \uXXXX Escapes
function toUnicode(str) {
  return str.split('').map(c => {
    const hex = c.charCodeAt(0).toString(16).padStart(4, '0');
    return '\\u' + hex;
  }).join('');
}
Decode \uXXXX String
function fromUnicode(str) {
  return unescape(str.replace(/\\u/g, '%u'));
}
console.log(fromUnicode("\\u4e16\\u754c")); // 输出: "世界"

* Use `String.fromCodePoint()` and `codePointAt()` for full compatibility with characters above U+FFFF.

Frequently Asked Questions

Q: Why do Chinese characters take 3 bytes in UTF-8 instead of 2?

A: Legacy GBK used fixed 2-byte allocations. Universal UTF-8 is a variable-length scheme: ASCII takes 1 byte, Western takes 2, CJK takes 3, and emojis take 4 bytes.

Q: What is modern ES6 `\u{XXXXX}` bracket notation?

A: Legacy `\u` was capped at 4 hex digits. ES6 introduced curly bracket syntax (`\u{1F680}`) to represent supplementary plane characters without surrogate pairs.

Q: Can full-width symbols be mapped to standard ASCII characters?

A: Yes. CJK full-width punctuation marks hold discrete independent Unicode points (U+FF0C). The tool isolates character codes with exact hex fidelity.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/