HTML Entity Encoder & Decoder

Encode HTML special characters to entities or decode entities back to characters. Prevent XSS and display HTML safely.

Last updated: June 1, 2026

What is HTML Entity Encoder?

An HTML entity encoder converts special characters into their HTML entity equivalents so they display correctly on web pages without being interpreted as HTML code. Characters like <, >, &, and " have special meaning in HTML — if you want to display them as visible text rather than markup, they must be encoded as &lt;, &gt;, &amp;, and &quot;. This tool also handles the reverse — decoding entity strings back to readable characters for editing.

How It Works

The encoder scans your input character by character, identifying characters that have reserved meanings in HTML. It replaces each with the corresponding named entity (like &amp;) or numeric entity (like &#38;). The decoder does the reverse — recognizing entity patterns and converting them back to the original characters. Both named entities (like &copy; for ©) and numeric entities (decimal and hexadecimal) are supported.

Common Use Cases

  • Preparing code examples for display on web pages without the browser interpreting tags
  • Encoding user-generated content before inserting it into HTML to prevent XSS attacks
  • Converting special characters in database content for safe HTML output
  • Decoding HTML entities in API responses or scraped content back to readable text
  • Preparing email template content where special characters need entity encoding
  • Encoding characters for use in XML documents and RSS feeds

Frequently Asked Questions

Which characters are encoded?

The five HTML special characters: & < > " ' are converted to their entity equivalents.

Learn More

Dive deeper with our guides related to HTML Entity Encoder:

Related Tools

If you find HTML Entity Encoder useful, you might also want to try these related tools from our Developer Tools collection: