Escape String Tool
Select JavaScript to escape or unescape string content. Other targets retain escape-only behavior. Everything is processed locally and displayed as text.
Escape or unescape string content
A QUICK WALKTHROUGH
How to use this tool
- Paste raw content without surrounding quote delimiters; each input and output is limited to 100,000 UTF-16 code units.
- Select a context. For JavaScript, choose Escape or Unescape.
- Convert, review the result or the error location, then copy the text.
Context-specific escaping
Ten escape targets: JSON, JavaScript, HTML text, HTML attributes, URL components, CSS strings, SQL string literals, shell single-quoted values, regular-expression literals and Markdown code spans. Unescape is available only for JavaScript.
JavaScript decode contract
Supported escapes: \n, \r, \t, \b, \f, \v, \0, \\, \', \" , \xNN, \uNNNN and \u{codepoint}. Hex digits are required; brace escapes use 1–6 hex digits and a Unicode scalar up to U+10FFFF. UTF-16 surrogate code units must form a high/low pair, including raw/escaped combinations. Lone surrogates and surrogate brace values are rejected.
Text-only processing
Input is raw string content: surrounding quotes remain ordinary characters. Octal escapes, a digit after \0, identity escapes and escaped line continuations are rejected with a one-based line/column in the source (UTF-16 columns). Output uses a textarea value; no code runs. Context escaping does not replace maintained encoders or parameterized APIs.
GOOD TO KNOW
Common questions
Does unescape accept JavaScript source code?
No. Paste only raw encoded string content without outer quotes. Quotes are retained; the input is never evaluated.
How are Unicode and invalid escapes handled?
Paired UTF-16 escapes decode to their Unicode character. Malformed, unsupported, out-of-range or unpaired sequences show a source location. Other contexts remain escape-only.
Is the input uploaded?
No. Processing stays in your browser; input and output each have a 100,000 UTF-16 code-unit limit.