HTML Escape

Convert special HTML characters to their entity equivalents for safe display.

Escape text so it shows correctly inside HTML instead of being read as markup: < becomes &lt;, > becomes &gt;, & becomes &amp; and quotes become &quot; and &#39;. Tick the option to also encode every non-ASCII character as a numeric entity, for systems that can't handle UTF-8. Use it to show code samples on a web page or to put user text safely into HTML.

Need the reverse? HTML Unescape

Common use cases

  • Show HTML or XML code as text on a web page
  • Put user-supplied text into an HTML template safely
  • Encode special characters for an old system

How to use

  1. Paste the text or code.
  2. Tick Also encode non-ASCII characters if needed.
  3. Copy the escaped result.

FAQ

Is escaping enough to stop XSS?

Escaping text placed between tags or inside quoted attributes is the core defence. Text going into scripts, URLs or CSS needs different handling; use your framework's built-in escaping.

How do I turn entities back into characters?

Use the HTML unescape tool.