HTML Entities Encoder
Example
Input:
<p class="x">Tom & Jerry © 2026</p>
Output:
<p class="x">Tom & Jerry © 2026</p>
About this converter
HTML reserves a handful of characters: & starts an entity, < and > delimit tags, and quotes delimit attributes. Writing them literally in content breaks pages or — when the text comes from users — opens the door to cross-site scripting (XSS), which is why escaping output is a baseline security habit, not a cosmetic one. Beyond safety, entities give you characters your keyboard or encoding cannot: © for ©, € for €, and numeric references like € for anything else, including characters with no name. This encoder prefers the readable named entity when one exists in its table and falls back to decimal numeric references, which every browser understands.
Frequently Asked Questions
Named or numeric entities — which should I use?
Named entities are easier to read and audit (© beats ©); numeric ones cover every character, including those without names. Both render identically.
Does entity-encoding make user input completely safe?
It is the essential step for displaying text in HTML, but full XSS defence also needs correct handling in attributes, URLs and JavaScript contexts. Encoding here covers the HTML text context.
Why is the apostrophe sometimes ' and sometimes '?
' is the XML/HTML5 name; older HTML4 parsers did not know it, so ' remains the most compatible choice for apostrophes.