Free Online HTML Entity Encoder & Decoder — Escape Special Characters
Convert between HTML entities and plain text. Encode special characters like <, >, &, and " for safe HTML display, or decode entity references back to readable text.
| Character | Entity | Numeric | Description |
|---|---|---|---|
| & | & | & | Ampersand |
| < | < | < | Less than |
| > | > | > | Greater than |
| " | " | " | Double quote |
| ' | ' | ' | Single quote (apostrophe) |
| |   | Non-breaking space | |
| © | © | © | Copyright |
| ® | ® | ® | Registered |
| ™ | ™ | ™ | Trademark |
| € | € | € | Euro sign |
| £ | £ | £ | Pound sign |
| ¥ | ¥ | ¥ | Yen sign |
| ° | ° | ° | Degree |
| ± | ± | ± | Plus-minus |
| × | × | × | Multiplication |
| ÷ | ÷ | ÷ | Division |
| — | — | — | Em dash |
| – | – | – | En dash |
| … | … | … | Ellipsis |
| ‘ | ‘ | ‘ | Left single quote |
| ’ | ’ | ’ | Right single quote |
| “ | “ | “ | Left double quote |
| ” | ” | ” | Right double quote |
| é | é | é | e acute |
| ñ | ñ | ñ | n tilde |
| ü | ü | ü | u umlaut |
What Are HTML Entities?
HTML entities are escape sequences that represent special characters in HTML. Characters like <, >, &, and " have special meaning in HTML syntax, so they must be "escaped" when you want them displayed as literal text on a web page.
An HTML entity starts with & and ends with ;. There are three formats: named entities (&), decimal numeric (&), and hexadecimal numeric (&). Named entities are easier to read, but numeric entities can represent any Unicode character.
Encoding is essential when displaying user-generated content to prevent XSS (Cross-Site Scripting) attacks. Decoding is useful when you need to read or edit content that has already been entity-encoded.
How to Use
- Choose Encode or Decode mode.
- Paste your text into the input area.
- Optionally toggle "Encode non-ASCII characters" for full encoding.
- The output updates instantly as you type.
- Click Copy to grab the result. Use the reference table below for quick lookups.
When You Need This
Displaying code snippets in HTML
When writing a tutorial and showing HTML code examples, you need to encode < and > so the browser shows them as text rather than parsing them as tags.
Preparing content for CMS input
Some CMS systems or email templates expect pre-encoded HTML. Encode your content here before pasting it into a WYSIWYG editor that strips special characters.
Decoding escaped content for editing
When you pull content from a database or API that stores HTML entities, decode it here to read and edit the actual text.
Preventing XSS in templates
When inserting dynamic values into HTML templates manually (without a framework that auto-escapes), encode them first to prevent script injection.
Tips
Always encode user input in HTML context
Any value that came from user input and will be rendered in HTML must be entity-encoded. This prevents XSS attacks where users inject <script> tags.
Use named entities for readability
& is more readable in source code than &. Use named entities for common characters and numeric entities only for unusual Unicode characters.
Don't double-encode
If content is already encoded (& is already there), encoding again turns it into &amp;. Check whether your framework auto-encodes before manually encoding.
Decode before processing text
If you need to search, count words, or transform text that contains entities, decode it first to work with the actual characters.
Examples
Encode HTML tags
Escapes angle brackets so they display as text.
Input
<script>alert("XSS")</script>Output
<script>alert("XSS")</script>Decode named entities
Converts entity references back to characters.
Input
<p>Hello & welcome</p>Output
<p>Hello & welcome</p>Limitations
- Encodes named entities for common characters only. Obscure Unicode characters are encoded as numeric references (&#x...;) rather than named entities.
- Does not handle full HTML documents — it processes text content only, not HTML tags or attributes.
- Cannot decode malformed or incomplete entity references (e.g., & without the semicolon).
- Reference table shows common entities only, not the full 2000+ named character references defined in HTML5.
Features
- Encode text to HTML entities (named and numeric)
- Decode named, decimal, and hexadecimal entities back to text
- Optional non-ASCII character encoding for full escaping
- Common entities reference table with character, name, and numeric code
- Instant conversion as you type
- 100% client-side, your data stays in your browser
FAQ
What's the difference between named and numeric entities?
Named entities like & use memorable labels. Numeric entities like & (decimal) or & (hex) use code points. Named entities are more readable but only exist for common characters.
When should I use the "Encode non-ASCII" option?
Enable it when you need to ensure your HTML is pure ASCII — for example, when targeting systems that don't handle UTF-8 well, or for older email clients.
Does this tool handle all HTML5 named entities?
It handles the most commonly used entities (50+). For rare named entities, use the numeric format (&#code;) which supports any Unicode code point.
Is my data sent anywhere?
No. All encoding and decoding runs in your browser using JavaScript. No network requests are made. Your content stays completely private.
Should I encode content in React/Vue/Angular?
Modern frameworks auto-escape content rendered with {variable} or {{ variable }}. You only need manual encoding when using dangerouslySetInnerHTML (React) or v-html (Vue).
Content last reviewed: June 2026
Your Privacy
All encoding and decoding happens entirely in your browser. No data is uploaded to any server. Your text never leaves your device.
Tips & Related Workflows
- Need to encode for URLs instead of HTML?URL Encoder/Decoder.
- Working with Base64 data?Base64 Encoder/Decoder.
- Need to format XML that contains entities?XML Formatter.