Free HTML Encoder & Decoder
Encode special characters to HTML entities or decode entities back to plain text. Instantly, in your browser.
Common HTML entities reference
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 á or “), the tool delegates to the browser's own HTML parser as a zero-cost fallback.
- 1Regex scans for characters to replaceOn 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.
- 2Lookup table or codePointAt() produces the entityFor named-entity output, matched characters are looked up in a hardcoded table (e.g. & → &, © → ©). 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.
- 3Single-pass regex decodes entities back to charactersOn decode, a single regex pass identifies all entity tokens (&, A, A, 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.
- 4Result appears instantly; copy to clipboard via Clipboard APIOutput 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
URL Encoder & Decoder
Encode and decode URLs and query strings. Supports encodeURIComponent, decodeURIComponent, and query string parsing.
Base64 Encoder & Decoder
Encode text or files to Base64, or decode Base64 strings back to plain text. Instant, private, and free.
Caesar Cipher & Text Encryptor
Encrypt and decrypt text with Caesar cipher, ROT13, Atbash, and Vigenère cipher. Classic substitution ciphers, all in your browser.