Skip to content
Free online tool

HTML entity encoder and decoder

Escape special characters as HTML entities so they display as text, or decode entities back into readable characters. Choose named, decimal or hexadecimal entities, and optionally encode every non-ASCII character.

Mode

Your input is handled as plain text: it is never inserted into this page as HTML and scripts in it are never run.

How to encode or decode HTML entities

  1. Choose Encode or Decode.
  2. Paste your text, HTML or entities into the input box.
  3. When encoding, choose whether to encode only special HTML characters or every non-ASCII character too, and pick the entity style.
  4. Copy the result, or click Swap to reverse it.

Why encode HTML entities?

Characters like <, > and & have special meaning in HTML. If you want to show them as text, for example to display a code example in a blog post, they must be written as entities: &lt;, &gt; and &amp;. Escaping quotes also keeps values safe inside HTML attributes. This is a key step in preventing broken pages and cross-site scripting when inserting user content into HTML.

The non-ASCII option converts characters like é, ©, € and emoji into entities, which helps with old systems or email templates that don’t handle UTF-8 well. Named entities such as &copy; are used where they exist; otherwise numeric entities like &#169; or &#xA9; are used. Decoding understands all named and numeric entities defined in HTML.

Safety: your input is always treated as plain text. It is never inserted into this page as HTML, and any scripts in it are never run, so you can safely paste untrusted snippets.

Common uses

HTML entity FAQ

Which characters must be encoded?

At minimum &, < and > in text, plus quotes inside attribute values.

Named or numeric entities?

Both work in all browsers. Named entities are easier to read; numeric ones exist for every character.

Is encoding enough to prevent XSS?

Encoding is essential, but the right method depends on context (HTML, attributes, JavaScript or URLs). Use your framework’s built-in escaping in real applications.

Need another tool?

Browse all 50 free tools for PDFs, images, text, SEO, calculations and development.

Explore All Tools