go-supertools
Developer & Data Tools

HTML Entity Encode

Encode &, <, >, and quotes as HTML entities.

Runs in your browser Your input never leaves your device.

0 characters | 0 words

About this tool

Replaces the five characters that have special meaning in HTML with safe entities: & becomes &amp;, < becomes &lt;, > becomes &gt;, a double quote becomes &quot; and a single quote becomes &#39;. This lets you show code or text on a page without the browser treating it as markup. All other characters, including accented letters and emoji, are left as they are; they do not need escaping if your page uses UTF-8. Encoding helps when placing text inside HTML content or quoted attributes, but it is not a complete security solution on its own. It runs in your browser.

How to use it

  1. Paste the text or HTML you want to display literally.
  2. Copy the encoded output.
  3. Paste it into your HTML source.

Example

Input
<a href="x">Tom & 'J'</a>
Result
&lt;a href=&quot;x&quot;&gt;Tom &amp; &#39;J&#39;&lt;/a&gt;

Common problems

Accented letters are not converted
Only five characters are encoded. Make sure your page is served as UTF-8 so other characters display correctly.
Text is encoded twice
Encoding already-encoded text turns &amp; into &amp;amp;. Encode the raw source once.
Using it for security
Escaping rules differ in scripts, URLs and CSS contexts. This tool is only for HTML text and attribute values.