HTML Entity Encoder / Decoder
Convert special characters to HTML entities (& < > …) or decode named and numeric entities back to text. Safe, instant and entirely client-side.
When are entities needed?
Inside HTML text, the characters & < > (and " / ' inside attributes) must be escaped so the browser parses them as text instead of markup. Encoding converts them to & < > " '. The checkbox additionally escapes every non-ASCII character (é → é) for legacy E-mail templates and old CMSes; uncheck it to keep Unicode intact and escape only the five markup characters. Decoding understands all named, decimal and hex numeric entities.
How to use HTML Entity Encoder / Decoder
Paste untrusted text, HTML fragments or markdown-rendered snippets, and press Encode to escape the five markup-critical characters — ampersand, angle brackets and quotes. Press Decode to reverse the process, and run it repeatedly to unwrap text that passed through several layers of encoding.
Encoding user input before it enters an HTML template blocks the classic injection vectors and keeps your markup valid. Double-encoded strings like <div> from layered systems unravel in one or two passes, with the tool showing exactly which characters became which entities.
Frequently asked questions
Which characters become HTML entities?
The five XML-critical characters — ampersand, less-than, greater-than, double quote and single quote — plus optional extras such as non-breaking space and copyright.
When do I need to encode HTML?
Whenever untrusted or plain text is inserted into HTML: form echoes, code samples or comments. Encoding prevents broken markup and the most common XSS injection patterns.
What is the difference between named and numeric entities?
Named entities such as & are readable but limited to the standard set. Numeric entities like & work for every Unicode character and survive older parsers better.
Does decoding fix double-encoded text?
Yes. Paste text such as &lt;div&gt; and run decode repeatedly until only clean markup remains — the usual fix when data passed through several encoders.