HTML Entity Encode / Decode — Tinker
← Tinker
Input (HTML / plain text)
Encoded output
Encodes HTML special characters: < > & " ' and optionally all non-ASCII characters as numeric entities.

Why HTML Entity Encoding Matters

When user-supplied text is inserted into an HTML page without encoding, characters like < and & can break the page structure or — more critically — allow attackers to inject executable script tags. This is the root cause of Cross-Site Scripting (XSS), one of the most common web vulnerabilities.

Always encode at the point of output (when rendering), not at the point of input (when storing). Storing pre-encoded data corrupts it when used in non-HTML contexts.

Common HTML entities quick reference

CharacterNamed entityNumeric entityWhen to use
&&amp;&#38;Always — starts every entity
<&lt;&#60;In text content and attribute values
>&gt;&#62;In text content (technically optional but good practice)
"&quot;&#34;Inside double-quoted HTML attributes
'&apos;&#39;Inside single-quoted HTML attributes
non-breaking space&nbsp;&#160;Prevent line breaks between words
©&copy;&#169;Copyright symbol
&mdash;&#8212;Em dash in prose

Encode non-ASCII characters

Characters outside the basic ASCII range (accented letters, emoji, CJK) are safe in UTF-8 HTML pages, but some legacy systems or email clients may mangle them. Encoding them as numeric entities (&#x1F600;) guarantees they survive any transport.

© 2026, Tinker - tools · calculators · practice games