🔤 HTML Entity Encoder/Decoder
Encode special characters to HTML entities or decode HTML entities back to characters.
| Character | Entity |
|---|---|
| < | < |
| > | > |
| & | & |
| " | " |
| ' | ' |
| Character | Entity |
|---|---|
| | |
| © | © |
| ® | ® |
| ™ | ™ |
| € | € |
| Character | Entity |
|---|---|
| £ | £ |
| ° | ° |
| — | — |
| • | • |
| … | … |
What Is HTML Entity Encoding?
HTML entity encoding converts special characters into their HTML entity equivalents so they display
correctly in web pages without being interpreted as HTML markup. For example, the less-than sign
< must be encoded as < to prevent the browser from treating it
as the start of an HTML tag.
This process is also critical for security — HTML encoding user input is one of the primary defenses against Cross-Site Scripting (XSS) attacks.
Common HTML Entities
| Character | Entity Name | Entity Number | Description |
|---|---|---|---|
< | < | < | Less than |
> | > | > | Greater than |
& | & | & | Ampersand |
" | " | " | Double quote |
' | ' | ' | Single quote / apostrophe |
| © | © | © | Copyright symbol |
| ® | ® | ® | Registered trademark |
| — | — | — | Em dash |
Why Encode HTML Entities?
- XSS Prevention: Encoding user-supplied input before rendering it in HTML prevents attackers from injecting malicious scripts.
- Display Special Characters: Show characters like
<,>, and&as literal text instead of HTML markup. - Code Documentation: Display code examples in HTML pages by encoding the angle brackets and other special characters.
- Email Templates: HTML emails require proper entity encoding to render correctly across different email clients.
- XML Compatibility: XML documents require encoding of reserved characters just like HTML.
How to Use This Tool
- Paste your text or HTML into the input area.
- Click Encode to convert special characters to HTML entities.
- Click Decode to convert HTML entities back to characters.
- Copy the result using the Copy button.
Why Use This Tool?
- Prevent XSS vulnerabilities by encoding user input.
- Display special characters safely in HTML pages.
- Decode HTML entities for content extraction and migration.
- Runs entirely in your browser — your content stays private.
Frequently Asked Questions
What is the difference between named and numeric entities?
Named entities (<) are more readable, while numeric entities (<)
work for any Unicode character, including those without named entities. Both render the same result
in browsers.
Should I encode all characters or just special ones?
For security, encode at minimum the five critical characters: <, >,
&, ", and '. Full encoding (all non-ASCII characters) is
useful for ensuring compatibility with legacy systems.