About JavaScript Escape / Unescape
This tool converts between plain text and JavaScript string literals. It is useful for code generation, log templates, and embedded config strings.
Key Features
- Escape for JavaScript: Converts special characters into safe string sequences.
- Unescape: Restores sequences like
\\n,\\t, and\\uXXXXto real characters. - Option Controls: Supports Unicode output, slash escaping, and newline strategy.
- Sample + Copy: Includes sample input and one-click copy.
Common Escape Rules
| Source | Escaped |
|---|---|
\\ |
\\\\ |
" |
\\" |
' |
\\' |
| newline | \\n |
| tab | \\t |
Steps
- Enter plain text or escaped text.
- Configure options as needed.
- Click escape or unescape.
- Copy output from the result area.
FAQ
Why does unescape output look unexpected?
Make sure the input is a valid escape sequence string. Mixed raw backslashes and invalid sequences can change results.
When should I enable Unicode mode?
Use it when you need ASCII-safe output or stable cross-environment text transport.