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.
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):
<div class="a">& symbol</div>"symbol" is non-ASCII; with "all non-ASCII" enabled it becomes a numeric entity (e.g. 符).
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;artifacts