Unicode Escape Encoder & Decoder | \uXXXX & \u{XXXXXX}

EncodingRuns in Your Browser (No Uploads)
Loading…

Encode text to Unicode escape sequences (\uXXXX or \u{XXXXXX}) or decode Unicode escapes back to readable text. Essential for JavaScript, JSON, and programming—supports both 4-digit and 6-digit formats. Everything runs locally in your browser.

How to Use This Tool

  1. 1

    Choose Encode (text → Unicode escapes) or Decode (escapes → text).

  2. 2

    For encoding, select format: \uXXXX (4-digit) or \u{XXXXXX} (6-digit ES6).

  3. 3

    Paste or type your input; Live mode updates instantly.

  4. 4

    Copy the output for use in JavaScript, JSON, or other code.

  5. 5

    Use Swap to send output back to input and switch modes.

Use Cases & Examples

JavaScript String Literals

Encode special characters in JavaScript string literals for safe representation in source code.

JSON Data Encoding

Ensure Unicode characters are properly represented in JSON data for cross-platform compatibility.

Debugging & Development

Inspect and debug Unicode escape sequences in code, logs, and API responses.

ASCII-Only Systems

Safely represent international text in ASCII-only environments or legacy systems.

Educational & Testing

Learn about Unicode code points, surrogate pairs, and character encoding in programming.

Understanding Unicode Escapes

\uXXXX format represents Unicode code points up to U+FFFF using 4 hexadecimal digits.

Characters above U+FFFF use surrogate pairs: two \uXXXX sequences (high surrogate D800-DBFF, low surrogate DC00-DFFF).

\u{XXXXXX} is the ES6 format that directly represents any code point (U+0000 to U+10FFFF) without surrogate pairs.

Both formats are used in JavaScript strings, JSON data, and various programming languages.

Frequently Asked Questions

Q.What's the difference between \uXXXX and \u{XXXXXX}?

A. \uXXXX is the 4-digit format for code points up to U+FFFF (uses surrogate pairs for higher values). \u{XXXXXX} is the ES6 6-digit format that directly represents any Unicode code point without surrogate pairs.

Q.What are surrogate pairs?

A. Surrogate pairs are two \uXXXX sequences (high + low surrogate) used to represent code points above U+FFFF in the 4-digit format. For example, a smiley face (U+1F600) requires two 4-digit codes. The 6-digit format avoids this: \u{1F600}.

Q.Can I encode any Unicode character?

A. Yes. Both formats support all Unicode characters including Korean, Chinese, Japanese, emojis, and special symbols. The 6-digit format is simpler for characters beyond the Basic Multilingual Plane.

Q.Is Unicode escaping secure?

A. No—Unicode escaping is for representation in code and data formats, not security. Anyone can decode it. Use proper encryption for sensitive data.

Related Tools

Explore more developer tools

Browse All Tools