ToolMill.io

HTML Entity Encode / Decode — Escape & Unescape HTML

HTML Entity Encode / Decode converts special characters like <, >, &, and quotes into safe HTML entities (and decodes them back). Use it when working with HTML attributes, templates, CMS editors, Markdown docs, or when debugging copy/paste issues. Handles common named entities (e.g. &lt;, &gt;, &amp;, &quot;) and numeric entities. Runs 100% locally in your browser — no uploads — and works offline after installing ToolMill as a PWA.

Encoding

Try it

Examples

Encode HTML to entities
Input
<div>"x" & y</div>
Output
&lt;div&gt;&quot;x&quot; &amp; y&lt;/div&gt;
Decode HTML entities
Input
&lt;span title=&quot;Tom &amp; Jerry&quot;&gt;5 &amp;lt; 10&lt;/span&gt;
Output
<span title="Tom & Jerry">5 < 10</span>

When to encode HTML entities

Use entity encoding when you want characters like angle brackets, ampersands, or quotes to display literally instead of being interpreted as markup. That is especially useful for tutorials, CMS fields, Markdown documents, code samples, copied snippets, and HTML attribute values.

What gets encoded

The most common cases are <, >, &, and quotes. Depending on the workflow, you may see named entities such as &lt; and &amp;, or numeric forms such as ' and '. Different editors may choose different forms while still rendering the same visible character.

Practical workflows

This page is useful when you want to display raw HTML source in documentation, clean up entity-filled text copied from a CMS or support system, decode already-escaped strings from exports, or verify whether a pasted snippet has been escaped once or multiple times before publishing it.

Avoid double-encoding

A common mistake is encoding text that already contains entities. For example, a plain ampersand becomes &amp;, but an existing &amp; encoded again becomes &amp;amp;. If the pasted input already looks escaped, check it carefully before clicking Encode.

Context still matters

Entity encoding is useful for displaying literal markup and preventing accidental rendering in many content workflows, but it is not a complete substitute for context-aware escaping in every application. Decoded output can also become active markup again if you paste it into a live HTML editor or page builder.

Privacy and local processing

Before You Rely on Entity-Converted Text in Web Pages or Feeds

Before publishing or embedding the result, confirm the exact HTML context where it will be used and whether the destination system already performs escaping automatically. A correctly converted string can still be wrong if it is inserted into the wrong place or escaped twice.

Where HTML Entity Conversion Can Still Produce Unsafe or Unwanted Results

Entity conversion can help with display and escaping, but it does not guarantee safety in every context. Double-encoding, partial escaping, and mismatches between text content and attribute contexts can still leave output broken or misleading if the destination expects different handling.

How to Interpret Encoded and Decoded HTML Entity Output

Encoded output is intended to represent characters safely in HTML-related contexts, while decoded output restores the literal characters those entities represent. That does not automatically make the result appropriate for every place you might paste it, because HTML text nodes, attributes, scripts, and feeds can each have different escaping needs.

Because the conversion runs in your browser, you can inspect copied template fragments, CMS content, support messages, or partially escaped markup without sending that text to another site. That is practical when your snippets include internal content or drafts that should stay local.

Related tools