Skip to main content

Free HTML Encoder & Decoder

Encode special characters to HTML entities or decode entities back to plain text. Instantly, in your browser.

Works offline once loaded
Output:
Examples:
Plain text / HTML
Encoded HTML
Output will appear here...
Common HTML entities reference
&&
<&lt;
>&gt;
"&quot;
'&#39;
·&nbsp;
©&copy;
®&reg;
™&trade;
€&euro;
—&mdash;
…&hellip;

Common uses

  • Encode Content for RSS FeedsEncode HTML content for RSS feed item descriptions — required by the RSS 2.0 standard.
  • Sanitise User Input for HTML OutputEncode user-provided strings before inserting them into HTML — prevents XSS injection attacks.
  • Encode Special Characters for HTML EmailEncode characters like &, <, >, and © as HTML entities so they render correctly in all email clients.
  • Encode User Content for Web DisplayPrevent XSS attacks by encoding user-generated content before rendering it in HTML pages.
  • Encode Content for XMLEncode special characters for XML files, RSS feeds, sitemaps, and SOAP payloads.

How It Works

HTML encoding and decoding here runs entirely in your browser using hand-written regex replacement and a hardcoded named-entity lookup table — no third-party encoding library, no server round-trip. For decoding uncommon named entities (like &aacute; or &ldquo;), the tool delegates to the browser's own HTML parser as a zero-cost fallback.

  1. 1
    Regex scans for characters to replace
    On encode, one of two Unicode-aware regexes runs across your input: a targeted pattern covering ~25 common HTML-significant and special characters, or a broader pattern that catches every code point above U+007F. Each match is intercepted character by character.
  2. 2
    Lookup table or codePointAt() produces the entity
    For named-entity output, matched characters are looked up in a hardcoded table (e.g. & → &amp;, © → &copy;). For decimal or hex output, String.codePointAt() gets the Unicode code point and formats it as &#NNN; or &#xNNN; — surrogate pairs are handled correctly because the regex uses the Unicode 'u' flag.
  3. 3
    Single-pass regex decodes entities back to characters
    On decode, a single regex pass identifies all entity tokens (&amp;, &#65;, &#x41;, etc.) and routes each to the right handler: hex parseInt(base 16), decimal Number(), named reverse-lookup, or — for any entity not in the hardcoded table — a textarea element whose innerHTML the browser parses natively, returning the correct character from the browser's built-in entity table.
  4. 4
    Result appears instantly; copy to clipboard via Clipboard API
    Output is recomputed synchronously on every keystroke via React useMemo. Copying uses navigator.clipboard.writeText() — the modern async Clipboard API — with a silent catch for restricted contexts.

Related Tools

Frequently Asked Questions