HTML Entities Encoder & Decoder
Escape characters that have special meaning in HTML (& < > " ' `) so they render as text instead of being interpreted as markup. Useful when displaying user-generated content, building static sites, or quoting code samples. The "Also encode non-ASCII" toggle emits numeric entities (&#NNN;) for every character outside ASCII — handy for environments that don't support UTF-8. Decoding is the reverse: handles named entities (& © — etc.), decimal numeric (©), and hexadecimal numeric (©).
JavaScript is required to use the live tool. Please enable JavaScript and reload.
Frequently asked
Why escape HTML in user content?
Otherwise an attacker can inject <script> tags or other markup. Always escape user-supplied strings before embedding them in HTML — at minimum & < > " '.
What's the difference between named and numeric entities?
Named (©) is more readable; numeric (© or ©) works without an HTML5 entity table. Both are valid.
Does this handle XML?
XML uses a smaller fixed entity set: amp lt gt apos quot. Donfig's encoder produces output safe for both HTML5 and XML.