Free Online HTML Entity Encoder

HTML entity encoding escapes characters with special meaning in markup — `<`, `>`, `&`, `"`, `'` — into their named entity references so they render as literal text.

Your data is processed entirely in your browser and never sent to any server.

Instant results 100% private No signup needed

How to Use This Developer Tool

  1. Paste text into the input area.
  2. Read the encoded version in the output panel.
  3. Toggle encode all non-ASCII for legacy email compatibility.
  4. Click Copy to send the safe markup to your clipboard.

What Is a HTML Entity Encoder?

Any time user-supplied text is embedded in an HTML page, the five reserved characters need to be escaped or the page becomes a cross-site scripting vector. Modern frameworks escape automatically inside template expressions, but you'll still hit the manual case in static pages, transactional emails, RSS feeds, and code samples where you want the angle brackets to display rather than parse.

The encoder replaces the five HTML5-reserved characters with their named entities (`&lt;`, `&gt;`, `&amp;`, `&quot;`, `&#39;`) and optionally also numeric-encodes every non-ASCII character for maximum compatibility with old email clients that don't parse named entities outside the HTML4 set.

Frequently Asked Questions

What are HTML entities?
HTML entities represent special characters: < becomes &lt;, > becomes &gt;, & becomes &amp;. They prevent characters from being interpreted as HTML.
When do I need to encode?
When displaying user input or code in HTML to prevent XSS. Also when you need to show <, >, or & literally. Always encode untrusted content.
Numeric vs named entities?
Named entities (&lt;) are readable. Numeric (&#60;) work for any Unicode character. Both are valid; named are preferred when available.

Published by the WeGotEveryTool team. We build and test every tool in-house and update pages when the underlying spec, formula, or recommendation changes.

Reviewed: May 2026. Disclaimer: this tool is provided as-is for general informational use. For decisions with material consequences (medical, legal, financial, security) verify results against a qualified professional source.

Related Developer Tools