๐Ÿงฐ UtlKit

String Escape/Unescape

Escape and unescape special characters for JavaScript, HTML, and URLs.

๐Ÿ›

Report a Problem

Found a bug or have a suggestion? Help us improve this tool.

๐Ÿ“Š Data Summary (auto-filled)

Tool: string-escape ยท /tools/string-escape/

mode: js-escape

What is this tool?

String escape/unescape tool handles character escaping for various contexts. Escape special characters for JavaScript strings, JSON, HTML, CSS, and regular expressions. Also unescape encoded strings back to their original form. Prevents syntax errors and injection vulnerabilities in code.

How to use

  1. 1

    Select context

    Choose target (JavaScript, JSON, HTML, etc.).

  2. 2

    Input string

    Paste the text to escape or unescape.

  3. 3

    Get result

    Copy the escaped or unescaped string.

Frequently Asked Questions

Why do I need to escape strings?

Unescaped special characters (quotes, backslashes, newlines) break string literals in code. Escaping ensures the string is interpreted correctly by the parser. It also prevents injection attacks in HTML (XSS) and database queries (SQL injection).

Does it handle unicode?

Yes, unicode is properly escaped.

What characters need escaping in different contexts?

JavaScript strings: double quotes, single quotes, backslashes, newlines ( ), tabs ( ). JSON: double quotes, backslashes, control characters. HTML: < > & " ' (use &lt; &gt; &amp; &quot; &#39;). Regular expressions: . ^ $ * + ? ( ) [ ] { } | \. Each context has its own set of special characters that must be escaped to be treated as literal text.