๐Ÿ”ฃ HTML Entity Converter

Input
Output

Encode special characters like < and & into HTML entities (&lt;, &amp;, etc.), or decode them back. Useful when you need to display raw code or text safely inside HTML, such as posting a code snippet in a blog article.

How to use

  1. Choose "Encode" or "Decode" mode.
  2. Paste text, or a string containing HTML entities, into the input box.
  3. The converted result appears automatically.
  4. Click "Copy" to copy the result to your clipboard.

How the calculation works

In HTML, "<" and ">" open and close tags, "&" starts a character reference, and quotes delimit attribute values. To display these characters literally, you replace them with character references (entities). Encoding here turns & into &amp;, < into &lt;, > into &gt;, " into &quot; and ' into &#39;. The order matters: if & were not replaced first, the & in an already converted &lt; would be converted again into &amp;lt;. Optionally, non-ASCII characters such as Japanese can be turned into numeric references of the form &#number;. Decoding uses the browser's own HTML parser to turn references back into characters, so named references such as &copy; (ยฉ) and hexadecimal ones such as &#x3042; (ใ‚) are restored correctly too.

Worked example

Showing HTML code in a blog post Original: <a href="/">Home</a> Encoded: &lt;a href=&quot;/&quot;&gt;Home&lt;/a&gt; Placed in HTML, this displays the code as text instead of being read as a link. With the non-ASCII option on, a character such as "ใƒ›" becomes a numeric reference like &#12507;.

Things to be aware of

  • This is escaping for display. Embedding user input inside JavaScript or URLs needs further context-specific escaping.
  • In HTML saved as UTF-8, there is normally no need to convert Japanese text into entities.
  • Encoding twice produces things like &amp;lt;, which displays as "&lt;" on the page.
  • Your input is processed in the browser and never sent anywhere.

FAQ

Why do I need to convert characters to HTML entities?

Characters like <, >, and & are interpreted as part of an HTML tag, so they need to be converted to entities if you want them to display as literal text.

Can I use this to post code on a blog?

Yes โ€” if a code snippet would break your HTML when embedded directly, converting it to entities first lets it display correctly.

Does it convert Japanese characters too?

This tool mainly targets characters with special meaning in HTML, like <, >, &, and quotes. Japanese text itself is left as-is.

What happens when I decode?

It converts entity notation like &lt; and &amp; back into the original < and & characters.

Is my input sent to a server?

No, conversion happens entirely in your browser and nothing is sent externally.