Unicode & JavaScript string escapes

Client

Encode plain text into ES6-style \u{hex} for non-ASCII (and double backslashes), or decode pasted escapes including \uXXXX and \xNN.

Part of encoding tools. See also JSON string & Unicode.

Workspace

Encode replaces the field with escaped text; decode parses escapes in place.

Unicode escapes

?

Encode doubles \ and writes non-ASCII and control characters as \u{hex} (ES6). Decode understands \u{…}, \uXXXX, \xNN, and \n \r \t \\.

For JSON string literals, use the JSON formatter—this page is for raw escape debugging.

Common use cases

  • Turn pasted source with \u{1F600}-style escapes into real Unicode characters.
  • Emit braced escapes for non-ASCII when embedding snippets in JS or templates.
  • Compare with JSON string rules by using the JSON formatter for full documents.

Common mistakes to avoid

  • Pasting JSON with outer quotes

    This decoder expects escape sequences inside a raw string body—not a full JSON.parse input with surrounding quotes unless you strip them.

  • Unknown backslash sequences

    Sequences other than those listed on this page will error—add support in code if you need \b or \f.

FAQ

Is this the same as JSON.stringify?

Similar for some escapes, but JSON has stricter rules. Use this page for ad hoc escape debugging.

Does my text leave the browser?

No. All processing is local.

Common search terms

Phrases people search for that match this tool. See the full long-tail keyword index.

  • unicode escape decoder online
  • javascript \u{ } escape encoder
  • decode \uxxxx to text online
  • es6 unicode escape braced hex

Related utilities you can open in another tab—mostly client-side.