HTML Encoder / Decoder

Escape text to HTML entities, or decode HTML entities back to characters.

This free online HTML entity encoder and decoder converts &, <, >, " and ' to named HTML entities and back, plus decodes numeric entities. Looking to pretty-print or minify markup instead? Try the HTML Formatter. Runs entirely in your browser — nothing is sent to a server.

Examples:

Mode

Quick reference

&
&amp;
<
&lt;
>
&gt;
"
&quot;
'
&#39;
Output will appear here…

Decoded text (plain, not rendered as HTML)

Frequently asked questions

It escapes the characters that have special meaning in HTML — &, <, >, " and ' — into their named entity equivalents (&amp;, &lt;, &gt;, &quot;, &#39;) so the text can be placed inside HTML markup and displayed literally instead of being interpreted as tags or attribute syntax.
HTML encoding (this tool) escapes special characters like & < > " ' into entities so text is safe to embed inside markup — it does not change the structure of any HTML document. HTML formatting (pretty-printing) does the opposite job: it takes an existing HTML document and re-indents or minifies its tag structure without touching the text content. If you want to beautify or minify markup, use the HTML Formatter instead.
Switch this tool to Decode mode and paste text containing entities. It converts named entities (like &amp; &lt; &nbsp; &copy;) and numeric entities in both decimal (&#39;) and hexadecimal (&#x27;) form back to their original characters in a single pass.
Escaping the five core characters is a standard part of preventing cross-site scripting when untrusted text is placed inside HTML content, and this tool demonstrates exactly that transformation. It is not a complete security solution on its own — the correct escaping rules differ depending on whether text lands inside an HTML attribute, a URL, JavaScript, or CSS, so production applications should use a context-aware templating or sanitization library rather than relying on manual entity escaping alone.
This tool decodes entities in a single regex pass rather than repeatedly unescaping the string. A naive implementation that unescapes &amp; before &lt; in separate passes can turn &amp;lt; into a literal < — reintroducing markup that was never meant to be live. Decoding once, left to right, keeps &amp;amp; as the literal text &amp; and &amp;lt; as the literal text &lt;, matching what a real HTML parser does.
No. Everything runs locally with JavaScript in your browser. Nothing is uploaded or stored on a server.