Advertisement

Escape/Unescape Tool

Escape and unescape text for JavaScript strings, HTML entities and URLs. Paste code or text, pick a mode, and convert instantly.

Input

Paste text, pick a conversion mode.

Output

Result appears here.

Advertisement

What escaping means

Special characters break out of their context: a quote ends a JavaScript string, < starts an HTML tag, and a space is illegal in a URL. Escaping rewrites those characters into safe sequences, like \n, &lt; or %20, so the text survives the trip intact. Unescaping reverses the process.

When to use each mode

Use JavaScript escaping when embedding text inside code strings, HTML encoding when injecting user content into a page (it prevents broken markup and XSS), and URL encoding for query parameters and path segments. Picking the wrong one is a classic bug, so the mode selector keeps them clearly separated.

Escape/Unescape Tool FAQs

What is the difference between HTML encode and URL encode?
HTML encoding protects text placed inside a web page (turning < into &lt;), while URL encoding protects text placed inside a web address (turning a space into %20). They solve different problems and are not interchangeable.
Why did my JavaScript unescape fail?
The input must be a valid escaped sequence, like text copied from inside quotes in source code. A lone backslash at the end or an invalid \u escape will make parsing fail.
Does URL encode handle Unicode?
Yes. Characters outside ASCII are encoded as UTF-8 byte sequences, so emoji and non-Latin scripts convert correctly.
Is HTML encoding enough to prevent XSS?
It is the core defense for text inserted into HTML content. For values placed inside attributes, event handlers or JavaScript contexts, additional context-specific encoding is needed.
Is my text sent to a server?
No. All conversions run locally in your browser.
Advertisement