HTML Escape
Convert special HTML characters to their entity equivalents for safe display.
Escape text so it shows correctly inside HTML instead of being read as markup: < becomes <, > becomes >, & becomes & and quotes become " and '. Tick the option to also encode every non-ASCII character as a numeric entity, for systems that can't handle UTF-8. Use it to show code samples on a web page or to put user text safely into HTML.
Need the reverse? HTML Unescape
Common use cases
- Show HTML or XML code as text on a web page
- Put user-supplied text into an HTML template safely
- Encode special characters for an old system
How to use
- Paste the text or code.
- Tick Also encode non-ASCII characters if needed.
- Copy the escaped result.
FAQ
Is escaping enough to stop XSS?
Escaping text placed between tags or inside quoted attributes is the core defence. Text going into scripts, URLs or CSS needs different handling; use your framework's built-in escaping.
How do I turn entities back into characters?
Use the HTML unescape tool.
Related tools
- HTML UnescapeConvert HTML entities back to their original characters for normal text.
- XML EscapeEscape special XML characters for safe inclusion in XML documents.
- URL EncodeEncode text for safe use in URLs by converting special characters to percent-encoded format.
- URL DecodeDecode percent-encoded URLs back to readable text with special characters restored.
- Base64 EncodeConvert text or binary data to Base64 encoded string for safe transmission.
- Base64 DecodeDecode Base64 encoded strings back to original text or binary data.
- HTML Entity ReferenceIn Reference