Skip to content
Toolew.com

Unicode Escape Converter

Convert text to Unicode escape sequences for JavaScript, JSON, Python, Java, CSS and HTML, or turn escapes back into readable text.

Runs in your browser. Your data is not uploaded.
Loading tool…

This guide is not yet available in your language and is shown in English.

Tool guide

What this tool does

Unicode Escape Converter writes any character as an escape sequence in the syntax your language expects, from \u00E9 in JSON to \u{1F600} in ES6 and \U0001F600 in Python. It decodes every supported format back to text and lists each character with its code point and UTF-16 code units.

Source code, JSON files and configuration systems often need to stay pure ASCII, or need to show exactly which invisible or look-alike character is hiding in a string. Unicode escapes solve this by writing a character as its code point number. The catch is that every language spells escapes differently, and characters above U+FFFF, such as most emoji, are encoded as two UTF-16 surrogates in JavaScript and Java but as a single eight-digit escape in Python.

This converter handles those rules for you. JavaScript, JSON and Java output uses \uXXXX with automatic surrogate pairs, so 😀 becomes \uD83D\uDE00; ES6, Rust and Swift use \u{1F600}; Python and C use \U0001F600; CSS uses a backslash and hex digits; HTML uses &#x…; references; and U+ notation suits documentation. Decoding recognises all of these formats in the same input, even mixed together, and a table shows every character’s code point and UTF-16 units. Nothing is sent to a server.

How to use Unicode Escape Converter

  1. Paste text or escaped text into the Input box.
  2. Choose “Text to escapes” or “Escapes to text (any format)” as the Mode.
  3. Select the escape format for your target language.
  4. Decide whether to escape only non-ASCII characters or every character.
  5. Review the character table below the output to inspect individual code points, then copy the result.

Tips for better results

  • JSON only supports the \uXXXX form, so use the JavaScript / JSON format for .json files.
  • Escaping only non-ASCII characters keeps code readable while making accents and symbols explicit.
  • Use the character table to find invisible characters such as U+200B (zero-width space) or U+00A0 (no-break space).
  • In CSS, a space after an escape ends it; the tool adds that space so the next character is not swallowed.

Common use cases

  • Storing translated strings in a Java .properties file that must be ASCII.
  • Embedding emoji or symbols in a JavaScript source file safely.
  • Reading JSON API responses that show text as \u0928\u092e\u0938\u094d\u0924\u0947.
  • Writing CSS content values such as content: "\2192" for an arrow.

Common mistakes to avoid

  • Writing \u1F600 in JavaScript: \u takes exactly four digits, so this means U+1F60 followed by “0”. Use \uD83D\uDE00 or \u{1F600}.
  • Using Python’s \U format in JSON, which is invalid and rejected by parsers.
  • Forgetting to double the backslash when the escape sits inside another string literal, such as a regular expression in a string.

Frequently asked questions

What is a surrogate pair?

UTF-16 can only store values up to U+FFFF in one 16-bit unit. Characters above that are split into a high surrogate (D800–DBFF) and a low surrogate (DC00–DFFF). JavaScript and Java strings work this way, so they need two \u escapes for one emoji.

Can I decode a mixture of formats?

Yes. The decoder recognises \uXXXX, \u{…}, \UXXXXXXXX, \x{…}, \xHH, CSS escapes, HTML numeric references and U+ notation in a single pass.

Does the tool change line breaks?

By default line breaks are kept as they are. Turn off “Keep line breaks as is” to escape them as \u000A and \u000D.

Feedback & suggestions

Help us improve Unicode Escape Converter. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.