HTML Entity Encoder & Decoder

Encode special characters to HTML entities or decode entities back to readable text. Covers all standard HTML character references.

Runs in your browser. No data leaves your device.

Frequently Asked Questions

How does the HTML Entity Encoder work?

Encoding scans each character of your text and replaces reserved HTML characters (<, >, &, ", ') with their named entity equivalents (&lt;, &gt;, &amp;, &quot;, &#39;). Decoding creates a temporary DOM element, sets its innerHTML to the encoded string, and reads back the textContent, letting the browser's built-in HTML parser resolve all named and numeric entities automatically.

What are HTML entities?

HTML entities are special codes that represent characters in HTML. For example, &lt; represents <, &amp; represents &, and &nbsp; represents a non-breaking space. They prevent browsers from misinterpreting characters as HTML tags.

When do I need to encode HTML entities?

When displaying user-generated content, code snippets, or any text that contains characters like <, >, &, or quotes in HTML. Encoding prevents cross-site scripting (XSS) and rendering errors.

Can I decode entities back to normal text?

Yes. Paste HTML-encoded text and the tool converts entities back to their readable characters. This is useful when working with escaped HTML from APIs or databases.