HTML Escape

Escape HTML entities

Input

Output (Escaped)

About the HTML Escape

Characters like < and & have special meaning in HTML. To show them as text, for example in a code sample or in text a user typed, they have to be written as entities. This tool escapes text into HTML entities and unescapes entities back into plain text.

What gets escaped

  • & becomes &amp; and must go first, so the other entities are not double-escaped.
  • < becomes &lt; and > becomes &gt;, so tags show as text instead of being parsed.
  • " becomes &quot; and ' becomes &#39;, so values are safe inside HTML attributes.

Example

<a href="/">Home</a> & more

// escapes to

&lt;a href=&quot;/&quot;&gt;Home&lt;/a&gt; &amp; more

Unescaping

Flip the switch to Unescape to turn entities back into characters. Your browser does the decoding, so every named entity works, such as &copy; and &nbsp;, along with numeric ones like &#8364; for the euro sign.

Escaping and security

Escaping is the standard defence against cross-site scripting (XSS) when untrusted text goes into a page: an escaped script tag is displayed, not run. Frameworks like React escape text for you, so this tool is for HTML written by hand, such as templates, emails, documentation, and CMS fields.

Frequently asked questions

What does the HTML Escape tool do?
The HTML Escape tool converts special characters (like <, >, &, ', and ") in text to their corresponding HTML entities, making the text safe to include in HTML without breaking the page structure.
Why do I need to escape HTML characters?
Escaping HTML characters prevents text from being interpreted as code when displayed on a website. It's essential for safely displaying user-generated content, code snippets, or any text containing special characters.
How do I use the HTML Escape tool?
Enter your text in the input field, and the tool will automatically escape the special characters. Toggle between 'Escape' and 'Unescape' to convert in either direction, and use 'Copy to Clipboard' for the result.
What characters does HTML escaping convert?
HTML escaping typically converts characters like < (less than), > (greater than), & (ampersand), ' (single quote), and " (double quote) to their corresponding HTML entities (&lt;, &gt;, &amp;, &#39;, and &quot;).