Escape HTML Entities
Escape special characters into HTML entities so text displays safely in any HTML context.
About Escape HTML Entities
Any time you embed text inside HTML — a user comment, a search result, or a dynamically generated page — characters like < and & are a hazard, because browsers read them as markup. This tool converts those special characters into safe entities so the text displays exactly as written.
The escape pass converts ampersands, angle brackets, and quotes into their named entities, and the tool reports how many characters were changed. Double-encoding is avoided on input that is already escaped, and the unescape mode reverses the process, so the two together form a complete round-trip.
Front-end developers render user-generated content safely, template authors escape placeholders before inserting them into email or page markup, and QA testers verify that special characters survive storage and display. Escaping is a core habit for anyone who puts data into HTML.
How to Use
- Paste the text containing special characters.
- Press Escape.
- Copy the escaped output for safe embedding.
Example
Tom & Jerry <tag> Tom & Jerry <tag>
Ampersands and angle brackets become entities so browsers render them as text instead of HTML syntax.
FAQ
Why escape HTML?
It prevents characters like < and & from being interpreted as markup, which is both a correctness and a security practice.
Does this prevent XSS?
Escaping output is one layer of defense against XSS. Never rely on it alone — validate and sanitize input too.
Which characters are escaped?
Ampersands, angle brackets, and quotes are converted to their named entities by default.
When should I escape the text?
Escape before inserting the text into the page, because after insertion the characters are already part of the document and escaping would change what renders.
Does it escape newlines or carriage returns?
No. Line breaks are left as real characters, since HTML whitespace handling is controlled by CSS and converting them would change the layout unexpectedly.