DevToolbox

HTML Encoder / Decoder

Convert text to HTML entities and decode entities back to text.

Processed locally in your browser

Input

Output

What is the HTML Encoder / Decoder?

The HTML Encoder / Decoder converts text to HTML entities and back. Characters like <, >, &, " and ' have special meaning in HTML — displaying them literally requires entity encoding (&lt;, &gt;, &amp;, &quot;, &#39;), and reading encoded content requires decoding.

Encoding user-supplied text before inserting it into HTML is a fundamental defense against cross-site scripting (XSS). This tool encodes with a strict character map and decodes using the browser's own parser in a detached document, so no markup is ever executed or injected into the page.

How to use the HTML Encoder / Decoder

  1. Paste text containing special characters (to encode) or entity-encoded text (to decode).
  2. Click Encode to escape HTML characters, or Decode to convert entities back to text.
  3. Copy the result for use in your templates or documentation.

Examples

Encode

<a href="x">Tom & Jerry</a>  →  &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;

Decode named and numeric entities

&copy; 2026 &mdash; caf&#233;  →  © 2026 — café

Frequently asked questions

Which characters does encoding escape?

The five HTML-significant characters: & < > " and '. That's sufficient to safely display any text inside HTML content or attribute values.

Does decoding execute the HTML?

No. Decoding parses the input in a detached, inert document — scripts never run and nothing is added to the page. Only the resulting plain text is returned.

Does the decoder support named entities like &copy;?

Yes. Because decoding uses the browser's real HTML parser, all named, decimal, and hexadecimal entities are supported.