How it works
Five characters have special meaning in HTML: & < > " and '. They are replaced with & < > " and ' so browsers show them as text. Optionally, every non-ASCII character can be written as a numeric reference, such as é for é, for systems that cannot handle UTF-8.
Rules this tool follows
- The ampersand is always encoded, so existing entities are escaped too (& becomes &amp;). That is correct when you want to display the entity itself.
- Quotes are encoded by default, which makes the output safe inside attribute values.
- Numeric references can be decimal (é) or hexadecimal (é).
Example
Input
<p class="note">Tom & Jerry</p>
Output
<p class="note">Tom & Jerry</p>
Common uses
- Showing HTML or XML code examples on a web page.
- Putting user-supplied text into templates or attributes.
- Preparing text for CMS fields that expect HTML.
Limitations and notes
- Escaping protects HTML text and attribute values. Text placed inside <script>, CSS or URLs needs different escaping for those contexts.