HTML Entity Encoder & Decoder

Encode reserved HTML characters as entities or decode HTML entities back to readable text for snippets, CMS content, and templates.

HTML entity escaping is not a complete XSS sanitizer — it only changes representation. Processing stays in your browser.

Named uses & / < / > / ". Numeric uses decimal & / < / > / ". Decode accepts both. Escaping is not a full XSS sanitizer.

  • Input0
  • Output0
  • OptionsNamed (&)

Input

Output

What is this tool?

This HTML entity converter encodes reserved markup characters (&, <, >, ", ') into HTML-safe entity text, and decodes entity text back to readable characters. Use Named (&amp;, &lt;) or Numeric (&#38;, &#60;) when encoding; decode accepts both.

Entity rules differ by context: text nodes, attributes, JavaScript strings, CSS, SVG, and XML are not identical. This page helps inspect snippets, CMS copy, and feed fields. Production rendering should still rely on framework escaping and a trusted sanitizer for untrusted HTML.

Conversion updates live in your browser. Nothing is uploaded.

Common use cases

  • Show literal markup in docs or blog posts without the browser treating it as tags
  • Fix or inspect double-encoded CMS / WYSIWYG content (&amp;amp; loops)
  • Prepare titles or descriptions for RSS/Atom and other XML-ish feeds where & must be escaped

How to use

  1. Choose Encode or Decode. Results update as you type.
  2. On Encode, leave Numeric off for named entities (&lt;div&gt;), or turn it on for decimal references (&#60;div&#62;).
  3. Paste text or entity-encoded text. Use Sample for <div>&lt;div&gt;.
  4. Copy the output. For untrusted HTML, still sanitize—entity escape alone is not XSS defense.

Named vs numeric

InputNamed encodeNumeric encode
<div>&lt;div&gt;&#60;div&#62;
Tom & JerryTom &amp; JerryTom &#38; Jerry
"quote"&quot;quote&quot;&#34;quote&#34;

Decode of either column returns the original input. Prefer named for readable source; prefer numeric when a consumer is picky about named references.

Examples

Input / settingOutputNotes
<div> → Named encode&lt;div&gt;Markup shown as text.
&lt;div&gt; → Decode<div>Round-trip of the sample.
Tom & Jerry → NamedTom &amp; JerryAmpersand for HTML/XML text.
A > B → NumericA &#62; BSame meaning as &gt; when decoded (edge vs named).

Practical pitfalls

  • Escaping text is not the same as sanitizing HTML. Attribute injection, javascript: URLs, and SVG/script contexts need different defenses.
  • Double encoding (&amp;lt;) is common after CMS round-trips; decode once and check whether another pass is still needed.
  • This tool escapes the five reserved characters only. It does not turn every Unicode character into a numeric entity (use Unicode encode/decode for &#x…; code-point forms).

References

Last reviewed: 2026-07-26

Frequently asked questions

When should I encode HTML entities?
Encode when text must display literally inside HTML—code samples, CMS fields, RSS/Atom titles, or user-provided snippets—so `<`, `>`, and `&` are not parsed as markup.
Does this sanitize HTML or stop XSS?
No. Entity encoding changes representation for text contexts. It is not a full HTML sanitizer and does not cover every XSS context (attributes, URLs, JavaScript, CSS). Use your framework’s escaping and a trusted sanitizer for untrusted HTML.
What is the difference between named and numeric entities?
Named forms like `&amp;` and `&lt;` are readable in source. Numeric forms like `&#38;` and `&#60;` are decimal character references and work the same when decoded. Decode accepts both; encode lets you prefer either style.
Is input uploaded?
No. Encode and decode run only in your browser.