Skip to content

HTML Entity Encoder & Decoder

Escape & < > " ' (and optionally all non-ASCII) into HTML entities — or decode the other way.

Input

What this tool does

HTML entity encoding turns characters that would otherwise be parsed as markup (&, <, >, ", ') into their &name;or &#NNN; equivalents. This tool encodes either the minimal five characters (default) or every non-ASCII character as a numeric entity. Decode handles named entities plus decimal and hex numeric forms. Runs entirely in your browser.

How to use it

Pick Encode or Decode, choose the mode for encode, and paste your input.

Input:  <p class="a">Café & co.</p>
Output: &lt;p class=&quot;a&quot;&gt;Café &amp; co.&lt;/p&gt;

Limits and edge cases

  • Minimal mode escapes only the 5 chars HTML requires. Use it when you control the document encoding (UTF-8 throughout).
  • All mode additionally escapes every non-ASCII character as &#NNN;. Safer for documents with unknown or mixed encodings — produces larger output.
  • Decode uses your browser’s built-in HTML parser, so the full named-entity table is supported (~2,200 entries).

Frequently asked questions

Is anything sent to a server?
No. Both encode and decode happen entirely in your browser.
Should I escape ' as &apos; or &#39;?
&#39; is universally safe. &apos; is XHTML/HTML5 only — older HTML 4 parsers may not recognise it. This tool emits &#39; for that reason.
Why does &not get decoded even when I didn't terminate it?
&not is a real HTML entity (¬, U+00AC). The browser parser is lenient about the trailing semicolon for legacy entities — a documented quirk, not a bug.
When should I use 'All' mode?
When your document encoding isn't UTF-8, when you're embedding text in an environment that might mangle bytes (older email systems, certain XML pipelines), or when readability of the ASCII source matters more than file size.