HTML Encode/Escape
Convert HTML special characters to entities to safely display HTML code and prevent XSS attacks.
Examples
HTML Tags
Prevents HTML from being rendered
<div class="container">Hello World!</div><div class="container">Hello World!</div>Script Tag
Prevents XSS attacks
<script>alert("XSS")</script><script>alert("XSS")</script>Attributes
Escapes quotes and special chars
<a href="javascript:void(0)" onclick="alert('test')">Link</a><a href="javascript:void(0)" onclick="alert('test')">Link</a>Special Symbols
Converts symbols to entities (Named mode)
© 2024 Company™ · Price: €99 & £75© 2024 Company™ · Price: €99 & £75International
Handles international characters (All mode)
Café • Résumé • 北京Café • Résumé • 北京;Click any example to load it into the encoder
Common HTML Entities
About HTML Encoding
HTML encoding converts special characters into HTML entities to ensure they are displayed correctly in web browsers and not interpreted as HTML code. This is essential for preventing XSS (Cross-Site Scripting) attacks and displaying HTML source code on web pages.
Encoding Types:
- • Basic: Encodes only essential HTML characters (< > & " ')
- • Named Entities: Uses human-readable entity names (e.g., © for ©)
- • All Special: Encodes all non-ASCII characters to numeric entities
Security Tip
Always encode user input before displaying it on a web page to prevent XSS attacks. Never trust user input and always sanitize it properly.