Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

HTML Entity Encoder & Decoder

Turn characters into HTML entities and back. Handles the reserved characters plus named and numeric entities. Runs in your browser.


    

What it does

Converts text to HTML entities and back. Encode replaces the five HTML-reserved characters — &, <, >, " and ' — with their entities so the text can be dropped into a page and shown literally instead of being parsed as markup. The result updates as you type and is ready to copy.

Why reserved characters matter

If you paste a < b && c > d straight into HTML, the browser tries to read < b ... as a tag and the text breaks or disappears. Encoding first turns it into a &lt; b &amp;&amp; c &gt; d, which displays exactly as written. The ampersand must be encoded too, otherwise a sequence like &amp; in your text would itself be decoded by the browser.

Encode all non-ASCII

Tick Encode all non-ASCII to also convert every character above code point 127 — accented letters, dashes, symbols, emoji — into decimal numeric entities such as &#233; for é. On a UTF-8 page this isn't needed for display, but it's useful when the output must be pure ASCII, for example an old email template or a pipeline that garbles raw bytes.

Decode

Decode reverses everything using the browser's own HTML parser, so it understands named entities (&amp;, &copy;, &apos;), decimal numeric entities (&#233;) and hexadecimal ones (&#xE9;) — the last two both resolving to é.

When to use it

Use encode when embedding user-supplied text, code samples or snippets of markup inside a page, and decode when cleaning up entity-laden text scraped from HTML. For escaping values across JSON, JavaScript and SQL as well, see Escape & Unescape; for URL percent-encoding, the URL encoder.

Privacy

Everything runs locally; nothing is uploaded.

Frequently asked questions

Do I need to encode accented letters like é or emoji?

Not for correctness, as long as your page is served as UTF-8 — modern browsers render é, — and emoji directly. Encoding them to numeric entities only helps when a file or pipeline must stay strictly ASCII, such as an older email template. Tick Encode all non-ASCII for that case; otherwise leave it off and keep the text readable.

What's the difference between &#39; and &apos; for the apostrophe?

Both represent the single quote, but &#39; is a numeric entity that works everywhere, while the named &apos; is defined in HTML5 and XML but not HTML4. This encoder outputs &#39; so the result is safe in older HTML and in XML alike. Decoding accepts &apos; too, so either form round-trips back to an apostrophe.

Can it decode hex entities like &#xE9;?

Yes. Decode handles named entities (&amp;, &copy;), decimal numeric entities (&#233;) and hexadecimal numeric entities (&#xE9;), all of which resolve to the same character — here, é. It uses the browser's own parser, so the full standard set of named entities is recognised.

Related tools