Escape HTML special characters to prevent XSS attacks.
🌐 Escapes & < > " and '. Use before inserting user input into HTML to prevent XSS.
HTML escaping converts special characters (& < > ") into their entity equivalents (& < > "), so they display correctly in a browser and prevent XSS attacks.
If user input contains <script> and you insert it into a page without escaping, the browser runs the script — a classic XSS (cross-site scripting) attack. Escaping turns it into harmless text that displays as <script> instead of executing.
& → & (must be escaped first)< → <> → >" → "' → 'Escaping rules differ by where text will appear. HTML body escaping (this tool) is different from attribute escaping, URL escaping, or JavaScript string escaping. Always escape for the specific context — using the wrong one can leave vulnerabilities.
More tools you might find useful
Convert HTML entities back to readable characters.
All 62 IANA status codes searchable by number or keyword, with fixes.
Registry country lengths plus the ISO 7064 mod-97 checksum, in your browser.
Turn an image into a Base64 data URI for inline embedding.