HTML Entity Encoder & Decoder

Escape text into HTML entities or decode entities back to characters. Processed locally in your browser.

Result appears here…
Advertisement

What this tool does

Certain characters have special meaning in HTML. If you display user content without escaping them, the browser may interpret it as markup — breaking your page or enabling cross-site scripting (XSS) attacks. HTML entity encoding replaces those characters with safe codes so they appear as plain text.

The key characters

  • < becomes &lt;
  • > becomes &gt;
  • & becomes &amp;
  • " becomes &quot;
  • ' becomes &#39;

Example

The string <b>Hi & bye</b> encodes to &lt;b&gt;Hi &amp; bye&lt;/b&gt;, which a browser renders literally instead of making bold text.

Limitations

  • Encoding for display is only one layer of defense. Always combine output encoding with proper input validation and a Content Security Policy.
  • This tool escapes the five core characters, which is the standard recommendation for HTML body and attribute contexts.

How to fix common problems

  • Double-encoded output (&amp;lt;): your input was already encoded. Decode it once first.
  • Entity not decoding: make sure it ends with a semicolon, e.g. &copy;.
Privacy: Encoding and decoding happen entirely in your browser.
Advertisement