</>

HTML Encoder / Decoder

Encode special characters as HTML entities or decode them back. Free, instant.

💻 Developer Tools Free Browser-based
Tool

What Is HTML Encoding?

HTML encoding converts characters that have special meaning in HTML — like <, > and & — into safe entity equivalents that browsers display as text rather than interpret as markup. For example, < becomes &lt; so the browser renders a literal less-than sign instead of starting an HTML tag. HTML decoding reverses this — converting entities back to their original characters so you can read encoded source without digging through entities manually.

Common HTML Entity Reference

CharacterEntity nameEntity numberUse case
&&amp;&#38;Ampersand in text and URLs
<&lt;&#60;Less-than / opening tag character
>&gt;&#62;Greater-than / closing tag character
"&quot;&#34;Double quote inside HTML attributes
'&apos;&#39;Single quote in HTML5 and XML
©&copy;&#169;Copyright symbol
®&reg;&#174;Registered trademark symbol
&euro;&#8364;Euro currency sign

Why HTML Encoding Matters for Security

Cross-site scripting (XSS) attacks inject malicious scripts into web pages by exploiting unencoded user input. If a user submits <script>alert(1)</script> and your application displays it raw, the browser executes it. Encoding all user-supplied content before displaying it in HTML prevents the browser from interpreting the content as markup. This is one of the most fundamental security practices in web development — every web framework provides an HTML encoding function for exactly this reason.

HTML Encoding vs URL Encoding

HTML encodingURL encoding
PurposeSafe display in HTML documentsSafe transmission in URLs and query strings
FormatNamed entities (&amp;) or numeric (&#38;)Percent sequences (%26)
Example: &&amp;%26
Example: space&nbsp; or left as-is%20 or +
'What is the difference between HTML and URL encoding?', 'a' => 'HTML encoding converts characters to entities (e.g. &lt; for <) for safe display inside HTML documents. URL encoding converts characters to percent sequences (e.g. %3C for <) for safe transmission inside URLs and form data. Use the correct encoding for the context.'], ['q' => 'Does this tool encode all Unicode characters?', 'a' => 'Enable "Encode extended chars" to convert all non-ASCII characters (like accented letters, Chinese characters and emoji) to their numeric HTML entity equivalents — useful when the target system cannot handle UTF-8 directly.'], ['q' => 'Why should I encode user input before displaying it in HTML?', 'a' => 'To prevent XSS (cross-site scripting) attacks. If you display unencoded user input, a malicious user can inject