Encode special characters to safe HTML entities and decode them back. Supports named, decimal & hex entities, attribute-safe mode, XSS-safe encoding, and a full 250+ entity lookup, the most complete free encoder online.
Encode / Decode HTML
Encode → Minimal📖 HTML Entity Reference — 250+ Entities
Click any entity to copy to inputWhat Is HTML Encoding?
HTML encoding is the process of converting characters that carry special meaning in HTML syntax into their safe entity equivalents. The five characters that must always be encoded in HTML text are & (→ &), < (→ <), > (→ >), " (→ "), and ' (→ '). Failing to encode user-controlled input is the root cause of Cross-Site Scripting (XSS), the number one web application vulnerability.
The WritoryBuzz HTML Encoder / Decoder goes beyond simple five-character encoding. It supports four encoding modes, three entity output formats, smart double-decode detection, and an inline entity lookup for all 252 named HTML entities — features most competing tools omit entirely.
Encoding Modes Explained
| Mode | Characters Encoded | Use Case | Security Level |
|---|---|---|---|
| Minimal | & < > " ' | HTML text nodes, safe attributes | Standard |
| Full (all non-ASCII) | Everything outside ASCII 32–126 | ASCII-only output, legacy systems | High |
| Attribute-safe | Minimal + / = ` and all control chars | User content in HTML attributes | Very High |
| JS-string safe | HTML + JS meta-chars (\\ <> / + =) | HTML inside <script> blocks | Context-specific |
Named vs Decimal vs Hex Entities
All three forms are syntactically valid HTML5 and decode to the same character. Choosing between them is a matter of readability, system compatibility, and preference.
| Form | Example (ampersand) | Coverage | Readability |
|---|---|---|---|
| Named entity | & | ~252 official HTML named entities | High — self-documenting |
| Decimal NCR | & | Full Unicode range (1,114,112 code points) | Medium |
| Hex NCR | & | Full Unicode range | Low — useful for hex-familiar devs |
HTML Encoding and XSS Security
Cross-Site Scripting (XSS) attacks inject malicious scripts into web pages viewed by other users. Proper HTML encoding is the primary server-side and client-side defence. However, encoding must be applied in the correct context — HTML encoding alone is insufficient when inserting data into JavaScript, CSS, or URL contexts.
✅ HTML Text Context (safe with minimal encoding)
Inserting user data between HTML tags. <p>{USER_INPUT}</p>
< > & "
✅ HTML Attribute Context (use attribute-safe mode)
Inserting data into tag attributes. <input value="{INPUT}">
" ' / `
⚠️ JavaScript Context (HTML encoding is NOT sufficient)
Data inside <script> blocks needs JSON encoding, not HTML encoding.
JSON.stringify(value)
⚠️ URL Context (use percent-encoding, not HTML encoding)
Query parameter values need URL encoding before HTML encoding.
encodeURIComponent() + HTML encode
OWASP Rule #1: Never insert untrusted data except in allowed locations. Rule #2: HTML-encode all untrusted data before inserting into HTML text. Rule #3: Attribute-encode all untrusted data before inserting into HTML attributes. Always apply the correct encoding for the insertion context — mismatched context encoding creates a false sense of security.
What Is HTML Decoding?
HTML decoding is the reverse process: converting HTML entity references back to their original characters. Browsers do this automatically when rendering HTML, but developers frequently need to decode encoded strings in server-side code, in email templates, in CMS content that has been double-encoded, or when inspecting data from APIs that return HTML-encoded JSON.
Common double-encoding problems
Double encoding occurs when content is HTML-encoded more than once, producing output like &lt; instead of the intended <. This happens frequently when:
- CMS plugins encode content before storage and again on output
- API responses contain HTML-encoded strings that are then embedded in HTML templates
- Copy-paste from HTML source into a WYSIWYG editor that also encodes
- Email marketing platforms double-encode special characters
The Smart Decode mode in this tool detects and fully unwinds multiple levels of encoding, producing clean plain text regardless of how many times the input was encoded.
HTML Entities Every Developer Should Know
| Character | Named Entity | Decimal | Category |
|---|---|---|---|
| & | & | & | Essential |
| < | < | < | Essential |
| > | > | > | Essential |
| " | " | " | Essential |
| ' | ' | ' | Essential |
| |   | Spacing | |
| © | © | © | Symbol |
| ® | ® | ® | Symbol |
| ™ | ™ | ™ | Symbol |
| € | € | € | Currency |
| £ | £ | £ | Currency |
| — | — | — | Punctuation |
| – | – | – | Punctuation |
| " | “ | “ | Punctuation |
| " | ” | ” | Punctuation |
| × | × | × | Math |
| ÷ | ÷ | ÷ | Math |
| ± | ± | ± | Math |
| ≠ | ≠ | ≠ | Math |
| → | → | → | Arrow |
Frequently Asked Questions About HTML Encoding
Convert text to UPPERCASE, lowercase, Title Case, camelCase, snake_case, kebab-case and more.
Open Tool →Reverse text by characters, words, or lines. Check palindromes. Flip any string instantly.
Open Tool →Count words, characters, sentences, paragraphs, and get a reading time estimate instantly.
Open Tool →