ToolHarbor

Unicode Escape/Unescape

Escape text to \uXXXX Unicode sequences or unescape encoded strings back to readable text. Convert non-ASCII characters to escape codes.

Features

  • Escape non-ASCII characters to \uXXXX sequences
  • Unescape \uXXXX sequences back to readable text
  • Option to escape all characters (including ASCII)
  • Handles surrogate pairs for characters outside the Basic Multilingual Plane
  • Swap between escape and unescape modes instantly
  • Works entirely offline — your text never leaves your browser

How to Use

  1. 1Choose "Escape" or "Unescape" mode
  2. 2Paste or type your text in the input field
  3. 3The escaped or unescaped result appears automatically
  4. 4Use the swap button to quickly reverse the operation
  5. 5Copy the result with the Copy button

Examples

Escaping special characters

Input

Café résumé naïve

Output

Caf\u00e9 r\u00e9sum\u00e9 na\u00efve
Escaping CJK characters

Input

你好世界

Output

\u4f60\u597d\u4e16\u754c
Escaping emoji

Input

Hello 🌍

Output

Hello \ud83c\udf0d

What Is Unicode Escaping?

Unicode escaping converts non-ASCII characters into \uXXXX escape sequences, where XXXX is the hexadecimal Unicode code point. This representation is commonly used in JSON strings, JavaScript source code, Java, C#, and many other programming languages where literal non-ASCII characters might cause encoding issues. If you need decimal ASCII codes for individual characters instead, see our Text to ASCII Converter.

For example, the character "é" (Latin small letter e with acute) has the Unicode code point U+00E9, so it is escaped as \u00e9. Characters outside the Basic Multilingual Plane (above U+FFFF), like emoji, are represented using surrogate pairs — two \uXXXX sequences that together encode the full code point.

Unicode escaping is essential when working with systems that only support ASCII safely: older protocols, certain database configurations, log files, and configuration formats. By converting non-ASCII text into ASCII-safe \uXXXX sequences, you ensure compatibility across any system. It is also useful for debugging encoding issues — seeing the exact code points makes it easy to identify mojibake, invisible characters, or unexpected byte sequences.

The unescape operation reverses the process: it finds all \uXXXX sequences in the input and replaces them with the corresponding Unicode characters. It also handles common escape sequences like \n (newline), \t (tab), and \r (carriage return).

Everything runs in your browser. Your text is never sent to any server — the conversion happens entirely in client-side JavaScript using native string operations.

Frequently Asked Questions

Related Tools