HTML Entity Encoder & Decoder — Encode HTML Entities Online [2026]
Encode special characters to HTML entities and decode HTML entities back to text. Supports named entities (&, <) and numeric entities (&). Free, browser-based, instant results.
Common HTML Entities Reference
| Character | Entity | Description |
|---|---|---|
| & | & | Ampersand |
| < | < | Less than |
| > | > | Greater than |
| " | " | Double quote |
| ' | ' | Apostrophe |
| (space) | | Non-breaking space |
| © | © | Copyright |
| ® | ® | Registered |
| ™ | ™ | Trademark |
| € | € | Euro sign |
| £ | £ | Pound sign |
| — | — | Em dash |
| – | – | En dash |
| … | … | Ellipsis |
| ° | ° | Degree |
What is HTML Entity Encoder/Decoder?
How to Use HTML Entity Encoder/Decoder
Paste your text containing special characters (like <, >, &, ", ') into the input field. Click "Encode" to convert them into HTML entities. The tool produces named entities (e.g., &amp; for &) by default where available, falling back to numeric entities (e.g., &#38;) for less common characters. To decode, paste HTML-encoded text and click "Decode" to convert entities back to their original characters. Use the copy button to copy the result to your clipboard.
How HTML Entity Encoder/Decoder Works
Common Use Cases
- Encoding user input to prevent XSS (Cross-Site Scripting) vulnerabilities
- Preparing code snippets for display in blog posts and documentation
- Converting special characters in email templates for correct rendering
- Encoding characters for embedding in XML and RSS feeds
- Fixing broken characters in copy-pasted text from other applications
- Decoding HTML entities found in API responses or scraped web content
Frequently Asked Questions
What are HTML entities?▼
HTML entities are special codes that represent characters in HTML. They start with an ampersand (&) and end with a semicolon (;). For example, < represents <, & represents &, and © represents ©. They are needed because some characters have special meaning in HTML (like < and >) or cannot be typed directly.
What is the difference between named and numeric entities?▼
Named entities use human-readable names like & (ampersand) or < (less than). Numeric entities use the Unicode code point number, either in decimal (&) or hexadecimal (&) form. Both produce the same character. Named entities are easier to read, but not all characters have named entities — numeric entities can represent any Unicode character.
Why do I need to encode HTML entities?▼
Encoding is essential for three reasons: (1) Security — encoding user input prevents XSS attacks where malicious HTML/JavaScript could be injected. (2) Correctness — characters like < and > must be encoded so browsers do not interpret them as HTML tags. (3) Compatibility — encoding ensures special characters display correctly across all browsers and email clients.
Which characters must be encoded in HTML?▼
Five characters must always be encoded in HTML content: < (less than) → <, > (greater than) → >, & (ampersand) → &, " (double quote) → " (in attributes), and ' (apostrophe) → ' (in attributes). Other characters like ©, ®, €, and non-ASCII characters can optionally be encoded for compatibility.
Does this tool support all Unicode characters?▼
Yes. The tool can encode any Unicode character to its numeric entity form (&#DDDD;) and decode any valid HTML entity — named or numeric, decimal or hexadecimal — back to the original character. This includes emojis, CJK characters, mathematical symbols, and all other Unicode code points.
Is the encoding/decoding done securely?▼
Yes. All processing happens entirely in your browser using JavaScript. No text is transmitted to any server, no data is stored, and no cookies track your input. The tool uses the browser's built-in DOMParser for decoding, which safely handles all entity types without executing any embedded scripts.
Related Tools
Base64 Encode/Decode
Paste text → get Base64 encoded output, or paste Base64 → get decoded text. One-...
Morse Code Translator
Convert text to Morse code and Morse code to text instantly. Listen to the audio...
HTML to JSX
Paste HTML → get valid JSX instantly. Auto-converts class→className, inline styl...