String escape / unescape
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 via String.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
~~~
Free books, courses, and software
Get my programming books, course editions, and complete software.
Get the download library →