HTML Character Encoder - Entity Converter Tool
Encode special characters to HTML entities for safe display in web pages. Prevent XSS attacks and display code correctly.
&
&<
<>
>"
"'
'©
©®
®™
™€
€£
£¥
¥—
—–
–…
…•
•°
°Why Encode HTML Characters?
HTML entities are encoded representations of special characters. Encoding prevents browsers from interpreting characters as HTML code, which is essential for security (preventing XSS attacks) and for displaying code snippets on web pages.
Security: Preventing XSS
Cross-Site Scripting (XSS) attacks occur when user input is rendered as HTML without encoding. If a user submits <script>malicious code</script>, it will execute unless encoded to <script>.
Required Encodings
- & → & - Ampersand (entity prefix)
- < → < - Less than (opens tags)
- > → > - Greater than (closes tags)
- " → " - Quote (attribute delimiter)
- ' → ' - Apostrophe (attribute delimiter)
Entity Formats
- Named: © → © (human-readable)
- Decimal: © → © (Unicode codepoint)
- Hexadecimal: © → © (hex codepoint)
When to Encode
- Displaying user-generated content
- Showing code examples in tutorials
- Embedding data in HTML attributes
- Generating HTML server-side