Skip to main content
Tools Harbor

HTML Entity Encoder / Decoder

Encode special characters as HTML entities or decode entities back to text. Includes a searchable reference of 150+ entities.

Format
Scope
Output

All processing happens locally in your browser. Nothing is uploaded.

HTML entity reference

Click any cell to copy. 195 of 195 entities shown.

Reserved HTML

CharNamedDecimalHex

Whitespace

CharNamedDecimalHex

Punctuation

CharNamedDecimalHex

Math

CharNamedDecimalHex

Currency

CharNamedDecimalHex

Arrows

CharNamedDecimalHex

Greek (uppercase)

CharNamedDecimalHex

Greek (lowercase)

CharNamedDecimalHex

Accented Latin

CharNamedDecimalHex

Symbols

CharNamedDecimalHex

HTML entity encoding replaces special characters like <, >, &, " and ' with safe equivalents (&lt;, &gt;, &amp;, &quot;, &#39;) so they render as literal text inside HTML instead of being parsed as markup. Paste text above to encode or decode in your browser — no upload, no signup.

Which characters must I encode in HTML?

Five at minimum: &, <, >, " and '. These are the structural characters that — left unescaped — can break the surrounding markup or open an XSS hole. Inside body text you always escape < and &; inside attribute values you always escape " and &. The other two are escaped by convention to keep the markup robust under rewriting.

For non-ASCII characters (©, , é, emoji), modern UTF-8 HTML doesn’t require entity encoding at all. You only need it when emitting into something that may transcode the page — legacy email, RSS in mixed encodings, CMS fields that strip extended characters.

Named, decimal, or hex — which format should I use?

The encoder supports three output shapes:

  • Named&copy;, &amp;, &trade;. The most readable and what code review expects to see in source.
  • Decimal numeric&#169;, &#38;, &#8482;. Works in every HTML version including HTML 4 and obscure email clients that don’t recognise extended named entities.
  • Hex numeric&#xA9;, &#x26;, &#x2122;. Preferred in JSON, CSP and XML attribute contexts where decimal can clash with other numerics.

All three are functionally equivalent in modern browsers. The “scope” toggle decides how aggressively to encode: Reserved only touches just the five structural characters; All non-ASCII also encodes every character above code point 127.

How does the decoder handle every variant?

The decoder accepts named entities (&copy;), decimal numeric (&#169;), hex numeric (&#xA9;) and all 250+ HTML5 named entities. It uses the browser’s own HTML parser via DOMParser, so anything the browser would render correctly, this tool decodes correctly — including malformed input that real-world HTML often contains.

When should I NOT encode HTML entities?

You don’t need to encode for URLs — use percent encoding via URL Encoder/Decoder. You don’t encode for JSON values — use JSON.stringify. You don’t encode for shell arguments — use proper argument arrays. Picking the wrong encoding produces output that looks right but breaks downstream.

You also don’t need to manually encode when using a templating engine that escapes by default (React JSX, Vue, Svelte, Jinja2, ERB, Liquid). Belt-and-suspenders encoding causes double-encoding — & becomes &amp;amp; and shows up visibly in output.

A searchable reference for the entities you actually need

The table below the encoder covers reserved HTML, whitespace, common punctuation (em-dash, curly quotes, copyright, trademark), math symbols, currency, arrows, full Greek alphabet, accented Latin and common pictographs — 195 entities across 10 categories. Click any cell to copy. Search by name (copy), by character (©) or by code point (169 or A9).

Privacy

Everything runs in your browser via DOMParser and string operations — no network round trip, no server, no logging. The reference table is static data shipped with the page. Verify in DevTools → Network: encoding triggers zero requests.

Frequently asked questions

Which characters must I always encode in HTML?
Five — `&` (`&amp;amp;`), `<` (`&amp;lt;`), `>` (`&amp;gt;`), `"` (`&amp;quot;`) and `'` (`&amp;#39;`). These are the structural characters that, left unescaped, can break markup or open an XSS hole. Inside attribute values you must always encode `"` and `&amp;`; inside body text you must always encode `<` and `&amp;`. The other two are encoded by convention to keep the markup robust under rewriting.
Named, decimal or hex — which encoding format should I use?
Named (`&amp;copy;`) is the most readable and is what most code review will expect. Decimal numeric (`&amp;#169;`) works in every HTML version including HTML 4 and obscure email clients that don't recognise extended named entities. Hex (`&amp;#xA9;`) is preferred in JSON/CSP/XML attribute contexts where decimal can clash with other numerics. All three are functionally equivalent in modern browsers.
Will this tool send my text to a server?
No. The encoder/decoder runs entirely in your browser using the standard `DOMParser` API. There is no upload, no logging, no analytics on what you paste. You can verify this in DevTools → Network — converting text triggers zero requests.
Does HTML5 still need entity encoding for non-ASCII characters like emoji or 你好?
Usually no. With UTF-8 (the default for HTML5) any Unicode character — emoji, CJK, accented Latin — can be written directly. Entity encoding for those characters is only useful when you're emitting into a context that may transcode (legacy email, RSS in unknown encodings, CMS fields that strip non-ASCII).
What''s the difference between HTML entities and URL encoding?
They solve different problems. HTML entities (`&amp;amp;`, `&amp;#60;`) protect characters that have meaning in HTML markup. URL encoding (`%26`, `%3C`) protects characters that have meaning in a URL. Encoding the wrong way produces garbage — for example, `https://example.com/?q=foo&amp;bar=1` should be URL-encoded to `?q=foo%26bar%3D1`, not entity-encoded.