Neatbo.

Unicode escape converter

Convert text to Unicode escapes or decode supported JavaScript-style escapes into readable text.

Browser-local processingInputText or supported backslash escapesOutputUnicode escapes or decoded text
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input
0 characters · 0 bytes
Options

Complete the required options first. You can keep the defaults for the rest.

For encoding only. Checked by default: keep printable ASCII, including quotation marks, while escaping backslashes and other characters. Clear it to write every UTF-16 code unit as a \uHHHH escape.

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.⌘ / Ctrl + Enter to run

Preparing the tool…

Before you start

Convert Unicode text to JavaScript-style \u escapes, or decode supported backslash escape sequences into text. Processing happens in your browser. Copy the complete result or download it as result.txt.

How to use this tool

  1. Paste ordinary text or supported backslash escapes into Text. Under Options, choose Encode or Decode in Operation.
  2. For Encode, leave Keep printable ASCII except backslash checked to retain printable ASCII characters. Clear it to escape every UTF-16 code unit. This option is hidden when decoding.
  3. Select Convert Unicode escapes and check the characters, backslashes and quotation marks. Use Copy result for the full text or download result.txt. Convert again after changing the input or options.

Supported inputs and limits

Paste up to 1 MiB of text, measured in UTF-8 bytes. This tool has no file input.

Encoding uses UTF-16 code units, so a character above U+FFFF is written as two \u escapes. Unpaired surrogates are rejected during encoding and after decoding.

The converter works on text contents as supplied. It does not remove surrounding quotation marks or parse a JavaScript or JSON document. Check the escape rules required by the destination.

Worked example

Example input

A中文😀
Example options
{}

Example output

A\u4e2d\u6587\ud83d\ude00

When something does not work

Check the original text for a trailing backslash, unsupported escape or incomplete hexadecimal sequence. Use two backslashes to represent one literal backslash when decoding. Keep surrogate pairs together and code point values within the supported Unicode range. Editing the input marks the previous result as stale, and a failed run clears it. Copy or download any result you need before refreshing or closing the tab.

Frequently asked questions

Which escapes can Decode read?

It reads four-digit \uHHHH sequences, \u{...} code point escapes with one to six hexadecimal digits, and two-digit \xHH sequences. It also recognizes \n, \r, \t, \b, \f, \v, \0, escaped backslashes, quotation marks and slashes. A \0 escape cannot be followed by a digit. Unsupported or incomplete escapes cause an error.

Is the result ready to paste into a quoted string?

Check the destination's quoting rules first. With the default encoding option, printable ASCII quotation marks stay unchanged, while backslashes and control characters are escaped. The converter does not add surrounding quotes or check a complete JavaScript string literal or JSON document. The result panel displays the output as text.

Documentation & further reading

Related tools