HTML Entity Encoder / Decoder
Convert special characters to HTML entities and vice versa
Common HTML Entities
What are HTML Entities?
HTML entities are special codes used to display reserved characters in HTML. Characters like <, >, and & have special meaning in HTML, so they must be encoded to display them as text.
Common HTML Entities
| Character | Named Entity | Numeric Entity | Description |
|---|---|---|---|
| < | < | < | Less than |
| > | > | > | Greater than |
| & | & | & | Ampersand |
| " | " | " | Double quote |
| ' | ' | ' | Single quote |
| |   | Non-breaking space | |
| © | © | © | Copyright |
Why Encode HTML Entities?
Prevent XSS Attacks
Encoding prevents malicious scripts from executing in user-generated content
Display Code Examples
Show HTML code as text without the browser interpreting it as markup
Valid HTML
Ensure your HTML validates correctly with properly encoded special characters
Cross-Browser
Entities work consistently across all browsers and character encodings
FAQ
What's the difference between named and numeric entities?
Named entities like < are easier to read. Numeric entities like < work for any Unicode character, even those without named equivalents.
When should I encode HTML?
Always encode user-generated content, code examples, and any text containing < > & or " characters to prevent XSS vulnerabilities and display issues.