HTML Entity Encode / Decode

Free online HTML entity encoder and decoder. Supports named entities (& < >) and numeric entities (& / &), escapes non-ASCII too. Runs in your browser.

Runs locally · data never uploaded
Advertisement

How to use

What it does

HTML entities escape characters that the browser would otherwise treat as tags or attributes, preventing XSS and rendering breakage. This tool supports two kinds:

  • Named entities: human-readable, e.g. &, <, >, ", ' (or '),  .
  • Numeric entities: code-point based, decimal & or hexadecimal &.

When encoding you can choose the scope: common chars escapes only the 5 high-risk characters (& < > " '); all non-ASCII also turns Chinese and other non-ASCII characters into numeric entities. Decoding auto-detects named and both numeric forms and restores them.

Example

Encoding <div class="a">& symbol</div> (common chars, named):

&lt;div class="a"&gt;&amp; symbol&lt;/div&gt;

"symbol" is non-ASCII; with "all non-ASCII" enabled it becomes a numeric entity (e.g. &#x7b26;).

Common uses

  • Safely displaying user input, code snippets and alerts inside a page
  • Producing plain text that can be embedded in HTML
  • Debugging weird double-escaped &amp;amp; artifacts

FAQ

Q1.When must I use HTML entities?
Whenever a piece of text contains <, >, &, " and you want them shown as literal text rather than interpreted as tags or entity references — most commonly when rendering user comments or code snippets.
Q2.Should I pick named or numeric entities?
Named entities read better but only a limited set exists; numeric entities (&#38; or &#x26;) can represent any code point and have the widest compatibility. Characters without a named form, like Chinese text, can only use numeric entities.
Q3.Why do I see double-escaped &amp;amp;?
It is usually caused by escaping twice in the render pipeline: text is escaped once (& → &amp;) and then escaped again as plain text (&amp; → &amp;amp;). Decoding once with this tool yields &amp;; decoding again yields &. Just decode layer by layer.
Q4.Is my input uploaded?
No. Encoding and decoding happen entirely in your browser and work offline.
Advertisement

Related tools