Developer Tools

String Escaper and Unescaper

Turn plain text into a quoted JSON or JavaScript string, or decode a quoted literal back to text. Handle quotes, backslashes, controls and Unicode locally, without executing input.

Your content stays on your device Free, with no account
Quotes and backslashes, made clear Local text processing
Escape: up to 100,000 UTF-16 units. Unescape: up to 600,010 units; paste one complete quoted literal without surrounding whitespace.

Escape adds the selected surrounding quotes. Unescape removes them and decodes one layer only. Input is treated as data and never executed.

YOUR RESULT

Ready. Choose a format and operation.

This handles string literals, not whole programs, HTML entities, URLs or regular expressions. JavaScript support is a documented subset. Escaping is context-specific; it is not a universal sanitizer.

What the backslashes mean

Accepted escape forms
NotationMeaningFormat
\n · \r · \t · \b · \fLine feed, carriage return, tab, backspace, form feedJSON and JavaScript
\\ · \" · \/ · \u0041Backslash, double quote, slash, Unicode unitJSON and JavaScript
\' · \v · \0 · \x41 · \u{1F30D}Single quote, vertical tab, NUL, hex unit, Unicode code pointJavaScript only; \0 cannot precede a digit

JavaScript modes reject identity escapes, legacy octal, line continuations, raw controls and raw U+2028/U+2029. Templates, concatenation and expressions are not accepted. Unpaired Unicode surrogates are rejected in every mode.

A FEW SIMPLE STEPS

How to use String Escaper and Unescaper

  1. Choose Escape text or Unescape quoted literal, then select JSON or a JavaScript quote style.
  2. For escape, paste plain text. For unescape, paste exactly one complete literal including its surrounding quotes.
  3. Optionally enable ASCII-only output when escaping. Select the action button to process one layer.
  4. Inspect the result, then copy it or download a plain-text file. Editing input or options clears the old output.
PRIVATE BY DESIGN

Why use this tool?

Your text is never uploaded to any server; all processing is completed locally in your browser. The tool does not execute input or store text history. Format-specific checks help catch malformed escape sequences before you copy the result.

Tool inputs stay in your browser. Only your theme preference is saved on this device.

A few things worth knowing

Does escape add surrounding quotes?

Yes. Escape produces one complete quoted string: double quotes for JSON and the selected quote style for JavaScript. Unescape requires those quotes and rejects surrounding whitespace. To escape text that already contains quotes, paste them as ordinary text; they are part of the content.

Which JavaScript escapes can I decode?

The supported subset includes escaped quotes, backslash and slash; b, f, n, r, t and v controls; NUL as backslash-zero when no digit follows; two-digit hex escapes; four-digit Unicode escapes; and braced Unicode code points with 1–6 hex digits up to 10FFFF. Identity escapes, legacy octal, line continuations, raw controls and raw U+2028/U+2029 are rejected. Templates, expressions and concatenation are not supported.

How does JSON mode differ?

JSON mode uses a complete double-quoted JSON string and JSON escape rules. JavaScript-specific forms such as single-quoted literals, hex escapes, braced Unicode escapes and vertical-tab shorthand are not JSON. Unescape decodes one layer only: an escaped backslash followed by n remains backslash plus n, rather than becoming a newline.

How is Unicode handled?

Valid Unicode characters are preserved by default. ASCII-only escape output uses four-digit Unicode units, including surrogate pairs for supplementary characters such as emoji. Unpaired surrogates are rejected before and after conversion. Escaping always writes controls, DEL, U+2028/U+2029 and less-than, greater-than and ampersand as explicit escapes. Counts are UTF-16 units, not visual characters. Textarea input follows the browser’s line-ending normalization.

Is this a sanitizer for every context?

No. String escaping is context-specific and does not replace HTML, URL, SQL or regular-expression encoding. The output is a string literal, not a full program. Input is never evaluated, and decoded text is displayed as plain text, including anything that resembles markup.

What are the size and download limits?

Escape accepts up to 100,000 UTF-16 units; unescape accepts up to 600,010. Output is limited to 600,010 units. Empty text escapes to an empty quoted literal, and an empty quoted literal decodes to empty text. Errors produce no partial output. Downloads are UTF-8 TXT files containing only the result, without an added newline.