HTML named entities let you show characters that would otherwise be interpreted
as markup. This tool escapes the critical characters and a useful table of
common symbols into their &name; form, and decodes them back to plain text.
When you need this
The three most common reasons to encode HTML entities:
- Displaying user content safely: if a comment field might contain
<script>text that you want to show on a page rather than execute, encoding the angle brackets neutralises it for display (though a server-side sanitiser remains essential). - Writing HTML inside HTML: a code blog post about
<div>tags needs<div>so the browser renders the angle brackets instead of parsing them. - Embedding special symbols: copyright
©, em dash—, non-breaking space, and accented letters can be encoded to ensure they survive character-encoding mismatches in older email clients or XML pipelines.
Decoding is useful when a CMS or API returns entity-encoded text (&amp;, <h1>) that you need to read or process as plain text.
How it works
Encoding replaces the ampersand first, then the remaining special characters, so no escape sequence is ever double-processed:
& -> &
< -> <
> -> >
" -> "
' -> '
© -> © (non-breaking space) ->
The ampersand-first rule is critical: if you encoded < before &, you would produce < — then a second pass over the ampersand would corrupt that into &lt;.
Decoding scans for &...; references, looks each named entity up in the table,
and also expands numeric references such as   and   so mixed input
is handled cleanly.
Worked examples
Example 1 — encoding a user comment:
Input: <b>Great article</b> & thanks!
Encoded: <b>Great article</b> & thanks!
The browser now displays the angle brackets literally instead of parsing them as a bold tag.
Example 2 — decoding API output:
Input: © 2025 Acme Corp — All rights reserved
Decoded: © 2025 Acme Corp — All rights reserved
Ready to display or process as plain text.
Tips and notes
- Always encode the ampersand before any other character — the most common bug in hand-rolled escapers.
- When placing user text inside an HTML attribute, double quotes must be escaped (
"), which this tool does. - For XML content, prefer a dedicated XML escaper: XML only recognises five standard entity names (
& < > " ') and rejects the hundreds of HTML-only named entities like©and . - Named encoding is a display helper, not a substitute for context-aware server-side sanitisation or a trusted HTML parser when rendering user-supplied markup.