HTML Entity Encoder / Decoder

Encode special characters to HTML entities or decode them back.

In HTML, characters like <, >, & and quotes have structural meaning — they open tags and delimit attributes. To display them as literal text, they must be converted to entities: &lt;, &gt;, &amp;, &quot;. Forgetting this is why code snippets vanish from blog posts and why unescaped user input opens the door to cross-site scripting (XSS) attacks.

This tool converts text to HTML entities and back. Use it to safely embed code examples in web pages, to debug already-escaped strings from templates and CMSs, or to inspect what a string full of &#x27; sequences actually says.

How to Use This Tool

  1. Paste the text or HTML to convert.
  2. Click Encode to escape special characters into entities, or Decode to convert entities back to characters.
  3. Copy the output into your HTML, template, or documentation.
  4. Use Encode whenever you are inserting untrusted or code-like text into a page.

Frequently Asked Questions

Which characters must always be escaped in HTML?

At minimum: & (as &amp;), < (as &lt;) and > (as &gt;). Inside attribute values you must also escape the quote character delimiting the attribute — usually double quotes (&quot;).

What is the difference between named and numeric entities?

Named entities like &eacute; are readable shortcuts that exist for common characters. Numeric entities like &#233; or hex &#xE9; work for any Unicode character. Browsers treat them identically.

How does escaping prevent XSS?

XSS happens when user input containing

Copied!