DEVELOPER TOOL

HTML Escape / Unescape Tool

Convert special characters to HTML entities so they display as text, or decode entities back into normal characters.

How to use the HTML Escape/Unescape Tool

Paste text or code into the input. Escape replaces the five characters that have special meaning in HTML: & becomes &amp;, < becomes &lt;, > becomes &gt;, a double quote becomes &quot; and a single quote becomes &#39;. Unescape reverses this and also understands numeric entities and named ones such as &copy;.

Escaping is what lets you display a snippet of code on a web page, or put user-supplied text inside HTML without it being treated as markup.

Examples and uses

<a href="x">Tom & Jerry</a> escapes to &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;.

Limitations and good to know

Escaping for HTML text and attribute values is covered here; it is not a substitute for proper escaping in JavaScript, CSS or URLs, which have different rules. Unescaping works on plain text only: any tags in the input are never created as elements, so nothing is executed. Do not escape text twice unless you intend to, as that produces visible entities like &amp;lt;.

Frequently asked questions

Why escape HTML?

So characters like < and & are treated as text, not markup. It prevents broken layouts and is a core defence against cross-site scripting.

Is unescaping safe?

Yes. Decoding is done without creating any elements, so scripts in the input are only returned as text.

Should I escape every character?

No. Escaping the five special characters is normally enough. The non-ASCII option is only for systems that need pure ASCII output.

Related tools

Looking for something else? Browse all free online tools on the ToolBox Free Hub homepage.