Back to Tools

HTML Entity Converter

Escape HTML into safe entities, or unescape entities back into characters. One toggle, instant results.

The moment you want to show HTML code on a web page — in a tutorial, a blog post, a code sample — you hit a wall: the browser renders

instead of displaying it. The fix is escaping: swapping the five special characters (& < > " ') for their HTML entities. This tool escapes and unescapes in both directions, handling named entities (&amp;, &lt;, &#39;) plus numeric forms like &#x2764; — so your code samples display as code and pasted entities turn back into readable characters. All conversion is local.

How to escape HTML

  1. Paste your text or markup into the input box.
  2. Pick the direction: Escape (characters → entities) or Unescape (entities → characters).
  3. Click Convert. Escaping covers &amp; &lt; &gt; &quot; and &#39; — the five characters that must be escaped in HTML content.
  4. Unescape also resolves numeric references like &#169; and &#x2764; back to real characters.
  5. Click Copy output when you’re done.

HTML escaping example

This raw HTML:

<a href="/docs">Docs & Guides</a>

escapes to:

&lt;a href=&quot;/docs&quot;&gt;Docs &amp;amp; Guides&lt;/a&gt;

Frequently asked questions

When do I need to escape HTML?

Whenever untrusted or literal text goes into an HTML context: displaying code samples, echoing user input, or embedding text that contains <, >, or &. Escaping is also the core defense against XSS when rendering user content.

Which characters get escaped?

The five that matter in HTML content: & (always first), <, >, " and ’. Other Unicode characters generally don’t need entities in modern HTML.

Does it support numeric entities on unescape?

Yes — both decimal (&#169;) and hexadecimal (&#x2764;) forms are converted back to their characters.

Install AI Directories — access tools offline, faster!

💬 How was this tool?

Thanks for your feedback!

It helps us improve AI Directories.

Keyboard Shortcuts

Focus searchCtrlK
Toggle dark modeCtrl\
Show shortcuts?
Close modalEsc
Loading... | ...