Loading HTML Encoder...
Please wait a moment

How to Encode & Decode HTML

Step 1

Choose Mode & Input Text

Pick Encode or Decode with the toggle button, then paste your HTML code or text. You can also use our HTML editor to prepare your code first.

Example: Encoding HTML

Input (before encoding):

<div class="example">Hello & Welcome</div>

Output (after encoding):

&lt;div class=&quot;example&quot;&gt;Hello &amp; Welcome&lt;/div&gt;
Step 2

View Results

The output updates on its own, encoding or decoding HTML entities as you type. You can then validate the output using our HTML validator.

Common HTML Entities

&lt; → <
&gt; → >
&amp; → &
&quot; → "
Step 3

Copy or Download

Copy the encoded/decoded text or download it as a file. You can also use our HTML beautifier to format the output or HTML viewer to preview it.

Frequently Asked Questions

What are HTML entities?

HTML entities are short codes that stand in for characters HTML would otherwise treat as markup. &lt; shows a <, &gt; shows a >, &amp; shows an & and &quot; shows a double quote. The browser displays the character instead of reading it as part of a tag.

Which characters does the encoder change?

Only five: & becomes &amp;, < becomes &lt;, > becomes &gt;, a double quote becomes &quot; and a single quote becomes &#39;. Everything else stays exactly as you typed it, including accented letters, emoji, line breaks and long numbers like 8901240544102066246. A page served as UTF-8 shows those fine without entities.

Is the encoded text safe to put into my page?

It is safe as text between tags and as the value of an attribute wrapped in double or single quotes, because none of the five special characters survive. It is not enough on its own in other places: unquoted attributes, inside <script> or <style> blocks, or in a URL such as href="javascript:...". Those need their own escaping, so lean on your framework's output escaping or a sanitizer like DOMPurify rather than treating entity encoding as a full XSS fix.

Why does &amp; turn into &amp;amp;?

The encoder treats your input as plain text, so an entity that is already there gets encoded again. That is what you want when you need to show the entity code itself on a page, for example in a tutorial. If your text is already encoded and you want the characters back, switch to Decode instead.

How does decode mode handle unusual entities?

Decoding uses your browser's own HTML parser, so named, decimal (&#169;) and hex (&#xA9;) entities come out the same way a browser would show them. That includes the few legacy names a browser accepts without a semicolon, so a bare &amp followed by text still decodes to &. Nothing you paste is run as HTML; the result only goes into a plain text box.

Is this tool free, and is my text sent anywhere?

It is free and needs no sign-up. Encoding and decoding happen in your browser, so the text you paste is not uploaded to our server.