ZenovayTools

HTML Encoder / Decoder

Encode special characters to HTML entities (&, <, >, ") and decode HTML entities back to plain text. Useful for embedding HTML in code and preventing XSS.

Encoding:
Common HTML Entities
CharacterEntityDescription
&&Ampersand
<&lt;Less than
>&gt;Greater than
"&quot;Double quote
'&#39;Single quote
©&copy;Copyright
®&reg;Registered
&trade;Trademark
&mdash;Em dash
&hellip;Ellipsis
(space)&nbsp;Non-breaking space
&euro;Euro sign

How to Use HTML Encoder / Decoder

  1. 1Paste or type your text in the input field.
  2. 2Click Encode to convert special characters to HTML entities.
  3. 3Click Decode to convert HTML entities back to plain text.
  4. 4Copy the output for use in your HTML, template, or code.
Zenovay

Privacy-first analytics for your website

Understand your visitors without invasive tracking. GDPR compliant, lightweight, and powerful.

Explore Zenovay

Frequently Asked Questions

What are HTML entities?
HTML entities are special codes used to represent characters that have special meaning in HTML or that cannot be typed directly. They start with & and end with ;. Named entities: &amp; → &, &lt; → <, &gt; → >, &quot; → ", &apos; → '. Numeric entities: &#60; = < (decimal), &#x3C; = < (hex). HTML parsers convert entities to their characters when rendering. Using entities prevents the browser from interpreting text as HTML markup.
Why encode HTML?
HTML encoding prevents: XSS (cross-site scripting) attacks — user input containing <script> tags gets encoded to &lt;script&gt; and rendered as text, not executed; HTML injection — untrusted content breaking page structure; Broken display — < and > in text being misinterpreted as HTML tags. Always encode user-generated content before inserting it into HTML. Use template engines or React (which auto-escapes by default) instead of raw HTML string concatenation.
What is the difference between &amp; and &amp;amp;?
&amp; is the HTML entity for the literal & character. &amp;amp; is double-encoded — it represents the text "&amp;" in HTML, which renders as "&amp;". Double encoding happens when you encode already-encoded text. If you need to display the text "&amp;" literally on a page, you write &amp;amp; in your HTML. This happens in code snippets and documentation showing HTML entity examples.
Should I use named or numeric HTML entities?
Both are valid. Named entities (&amp;, &lt;) are more readable. Numeric entities (&#38;, &#60; or &#x26;, &#x3C;) work for any Unicode character, even without a named equivalent. For safe practice: always encode at minimum &, <, >, " (and ' for attribute values). For full Unicode safety in older systems, encode all non-ASCII characters numerically. Modern UTF-8 HTML5 pages can include Unicode directly without encoding.
What is the htmlspecialchars function in PHP?
PHP's htmlspecialchars() converts &, <, >, ", ' to their HTML entity equivalents. Use ENT_QUOTES flag to encode both single and double quotes: htmlspecialchars($str, ENT_QUOTES, 'UTF-8'). htmlspecialchars_decode() reverses it. html_entity_decode() handles all named entities. In JavaScript: no built-in, but DOMParser or document.createElement + textContent can encode/decode. In Python: html.escape() and html.unescape().