ToolPick

HTML entity encoder and decoder

Escape text into HTML entities, or turn entities like < and © back into characters.

How it works

Encoding always escapes & < > " and '. In the all-non-ASCII mode every other character outside printable ASCII becomes a named entity when it is in the common set (the Latin-1 letters and symbols, typographic quotes and dashes, the euro sign, arrows and a few more, about 145 names) and a numeric entity such as &#128512; otherwise. Decoding is a single pass over entities that end in a semicolon, so &amp;lt; becomes &lt; and not <. Unknown names are left as written and listed.

Runs in your browser; nothing is uploaded.

FAQ

Is this enough to prevent XSS?

Escaping & < > " ' is the right step for putting text inside HTML element content or a quoted attribute. It is not enough for other contexts such as inline scripts, URLs or unquoted attributes, each of which needs its own escaping.

Why is the apostrophe encoded as &#39; and not &apos;?

&apos; is defined in XML and HTML5 but not in HTML 4, and some old parsers ignore it. The numeric form works everywhere. When decoding, both are understood.

Which entities does the decoder know?

The common set of about 145 names plus any numeric entity, decimal or hex. The full HTML5 list has over 2,000 names; one outside the common set is reported as unknown and left unchanged. Entities without the closing semicolon are not decoded, and numeric entities from 128 to 159 give the raw control character rather than the Windows-1252 character browsers substitute.

Related developer tools

Bookmark this page for next time, or copy its link. Shared links contain no working input.

Link to this tool: https://www.toolpick.dev/free-tools/html-entities