HTML Entity Encode / Decode

Paste text to escape &, <, >, " and ' for HTML, or paste entities such as &eacute; and &#233; to decode them. Encoding always covers those five characters and can convert every character above code point 127 to a hex reference. Decoding uses the browser's DOMParser and never executes markup. Nothing is uploaded.

Text
Encoded
Converted on this deviceNamed entities only

Runs in this tab · nothing is uploaded · Verify in 10 seconds →

What the HTML entity encoder/decoder does

Characters like <, > and & have special meaning in HTML, so literal text must be escaped as entities (&lt;, &gt;, &amp;) before it is placed in markup. This tool escapes text for HTML and decodes entities (named like &eacute; or numeric like &#233;) back into readable text.

How the HTML entity encoder/decoder works

Encoding always escapes the five HTML-critical characters (ampersand, angle brackets, double and single quotes), and, with the All non-ASCII toggle, also converts every character above code point 127 to a hexadecimal &#x…; reference. Decoding hands the string to your browser's own DOMParser and reads back the text content, so every entity the browser knows is handled. Both directions run in this tab.

~/faq

Frequently asked questions

When do I need the “All non-ASCII” toggle?

When the output must survive a non-UTF-8 pipeline, legacy email templates, ISO-8859-1 pages, systems that mangle multibyte characters. On a modern UTF-8 page you only need the five critical characters escaped.

Why is the apostrophe encoded as &#39; instead of &apos;?

&apos; is not defined in HTML 4, so old parsers do not understand it. The numeric form &#39; works everywhere, which is why it is the safer default.

Is escaping enough to prevent XSS?

Escaping these characters is the right move for text placed in element content or quoted attributes. Other contexts (URLs, inline scripts, CSS, unquoted attributes) need their own context-specific encoding, not HTML entities.

Does decoding execute any HTML?

No. DOMParser parses the string into an inert document that is never attached to the page, scripts do not run and images do not load. Only the resulting plain text is read out.