Skip to content
QKQuickKit日本語
Developer ToolsLOCALRuns in your browserInput may contain sensitive information

JavaScript String Escape

Escape text into an ECMAScript string literal, or decode a JavaScript string literal back to plain text.

This tool handles input and primary processing in your browser and is designed not to send the input to QuickKit’s server.

Avoid live production secrets; use dummy or masked data where possible. Data handling details

Output

How it works

Escape mode turns raw text into the body of a JavaScript string literal: the chosen quote character, backslash, and control characters are escaped (\n, \t, \xHH), U+2028 and U+2029 are always escaped, and ${ is escaped only for template literals. Non-ASCII is left as-is unless "ASCII only" is set, which emits \uHHHH (a non-BMP character becomes a surrogate pair \uD83D\uDE80). Unescape mode reverses this, recognising \\ \' \" \` \n \r \t \b \f \v \0 \xHH \uHHHH \u{H...} and line continuations, per ECMA-262 (verified 2026-09-02). One layer of matching wrapping quotes is stripped first; the input is otherwise never trimmed, so leading and trailing whitespace is preserved. Legacy octal escapes (\1–\9, or \0 followed by a digit) are rejected as they are in strict mode, modules, and template literals; any other \c decodes to the bare character c. This escapes string content only — it does not parse or generate JavaScript code. Input is capped at 512 KiB.