Encoders & Text

HTML Entity Encoder

Encode and decode named, decimal, and hexadecimal HTML entities.

  • History kept on this deviceRecent results are kept in this browser's local storage until you clear them.
  • Runs in your browserProcessing happens in this page. No application server receives your input.

Input

Output

HTML Entities (minimal XML 5)

What this tool does

This tool converts text between raw Unicode characters and XML/HTML character references entirely in your browser with zero network requests. When embedding user-supplied strings, code snippets, or markup fragments into HTML documents, attributes, or XML payloads, reserved syntax characters must be escaped as character references so that the parser treats them as literal text rather than executable tags or attribute delimiters.

In Encode mode (minimal), <a href="x"> becomes &lt;a href=&quot;x&quot;&gt;. In Decode mode, decimal numeric entity &#128512; (or hexadecimal &#x1F600;) decodes to 😀.

Encoding levels

  • Minimal (minimal): Escapes only the five XML syntax characters: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&#39;). All other ASCII and Unicode characters remain untouched.
  • Non-ASCII (nonAscii): Applies the minimal XML escapes and additionally converts every code point above U+007F into a decimal numeric reference &#N;. Supplementary astral-plane characters (U+10000..U+10FFFF) are iterated by full Unicode code point (for (const ch of input)) so each astral character emits a single &#NNNNN; entity rather than a split UTF-16 surrogate pair.
  • All (all): Encodes every character in the input string as its decimal numeric reference &#N; by code point.

Supported entities on decode

Decode mode resolves the five XML named entities (&lt;, &gt;, &quot;, &apos;, and &amp;), decimal numeric references (&#128512;, &#39;), and case-insensitive hexadecimal numeric references (&#x1F600;, &#X1F600;). Any numeric reference outside the valid Unicode scalar range (above U+10FFFF or within the UTF-16 surrogate block U+D800..U+DFFF) is rejected with an inline error while preserving your last valid output.

Security note: no double-unescaping

Decoding runs in a single left-to-right pass so decoded characters are never re-parsed as new entity tokens (GAP-039). Evaluating decodeHtml(encodeHtml('&lt;')) or decoding &#38;lt; and &#x26;lt; always yields the literal four-character string &lt; and never collapses a second time into <.

Limits

Decodes the 5 XML named entities plus numeric entities; does not include the full 2,200+ HTML5 named entity table (use T16 Unicode Inspector for code point lookup).

Inputs up to 1.0 MB run synchronously on the main thread, and payloads above 16.0 MB are refused before allocation.

Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.