← back to flaviocopes.com

String escape / unescape

← All tools

Escape or unescape strings for JavaScript, JSON, hex bytes, and Unicode — with surrogate pair support and clear error messages.

Your data never leaves the browser — no upload, no server.

~~~

Mode

JavaScript

JSON

Hex

Unicode

Input

Output

Error

~~~

About this tool

Escaping turns special characters into backslash sequences so strings survive inside code or JSON. JavaScript supports \n,\t, \uXXXX, and \u{…} for astral code points (surrogate pairs handled viaString.fromCodePoint).

JSON uses a smaller escape set. Hex mode shows raw UTF-8 bytes. Invalid escapes fail with a clear message instead of silent corruption.

~~~

Read more