About this tool
HTML uses <, > and & for markup, so to show those characters as text you write them as entities: <, > and &. This tool encodes text into entities and decodes entities back to text. It is also called HTML escaping and unescaping.
Encoding
- Only & < > " ' (default) is what you need to put user text safely into HTML: it prevents the text from being read as tags, which is the core of preventing XSS (cross-site scripting).
- Also non-ASCII turns characters like
é,€and✓into entities too, as named entities where one exists (é,€), or decimal/hex numeric references (é,é). Useful for email templates and systems that mangle UTF-8.
Decoding
Decoding uses your browser’s own HTML parser, so every one of the 2,231 named entities in the HTML standard works (✓, ≂̸, ♥…), as do numeric references and entities without the final semicolon, exactly as a browser would read them.
Common entities
| Character | Named | Numeric |
|---|---|---|
| & | & | & |
| < > | < > | < > |
| " ' | " ' | " ' |
| non-breaking space | |   |
| © ® ™ | © ® ™ | © ® ™ |
| € £ ¥ | € £ ¥ | € £ ¥ |
| — – … | — – … | — – … |
| “ ” ‘ ’ | “ ” ‘ ’ | “ ” ‘ ’ |
Encoding for HTML is not enough inside JavaScript, URLs or CSS, which each have their own escaping rules. Use the URL encoder for URLs and JSON escape for JavaScript strings.
FAQ
How do I encode HTML special characters?
Paste the text in Encode mode. &, <, >, " and ' are converted to &, <, >, " and ', so the text displays literally instead of being read as HTML.
How do I decode HTML entities?
Switch to Decode and paste the text. Every named and numeric entity, such as &, é or €, is converted back to its character.
What is the difference between and a normal space?
is a non-breaking space (U+00A0): it looks like a space but stops a line break there, and browsers do not collapse several of them into one.
Does HTML encoding prevent XSS?
Encoding & < > " ' is the right defence for text placed between HTML tags or in quoted attributes. Text inside <script>, URLs, CSS or event handlers needs different escaping.
Do I need entities for accented letters?
Not if your page is UTF-8, which almost all are. Entities for non-ASCII characters are only needed for systems that cannot handle UTF-8.