HTML Encode / Decode
Encode special characters to HTML entities or decode entities back to text. Free, instant, no sign-up.
Encoded or decoded output will appear here...All processing happens in your browser. Your input never leaves your device.
Why Use Our HTML Encoder / Decoder?
Instant Conversion
Encode or decode HTML entities in milliseconds. No processing delays, no server round-trips.
XSS Protection
Encoding HTML prevents cross-site scripting attacks by ensuring special characters are rendered as text, not markup.
All Entities Supported
Handles named entities, decimal numeric entities, and hexadecimal entities. Full HTML5 entity support.
Free Forever
No limits, no sign-up, no ads. Encode and decode as much HTML as you want, whenever you want.
How to Encode or Decode HTML Online
Paste Your Text
Paste raw HTML you want to encode, or paste entity-encoded text you want to decode.
Click Encode or Decode
Click Encode HTML to convert characters to entities, or Decode HTML to convert entities back to characters.
Copy the Result
Copy the encoded or decoded output and use it in your HTML, templates, or content management system.
HTML Entity Reference
Common HTML entities and their character equivalents. Use the encoder above to convert these automatically.
| Character | Named Entity | Numeric Entity | Description |
|---|---|---|---|
| & | & | & | Ampersand |
| < | < | < | Less than |
| > | > | > | Greater than |
| " | " | " | Double quote |
| ' | ' | ' | Single quote / apostrophe |
| |   | Non-breaking space | |
| © | © | © | Copyright |
| ® | ® | ® | Registered |
| ™ | ™ | ™ | Trademark |
| — | — | — | Em dash |
| – | – | – | En dash |
| ° | ° | ° | Degree |
When to Encode vs Decode HTML
When to Encode
- Displaying user-generated content to prevent XSS attacks
- Embedding code snippets in HTML pages or blog posts
- Inserting text into HTML attributes like title or alt
- Storing HTML-safe strings in databases or APIs
When to Decode
- Reading entity-encoded content from APIs or RSS feeds
- Converting encoded HTML back to editable source code
- Cleaning up content exported from CMS platforms
- Processing scraped web content that contains HTML entities
If you need to format and beautify your HTML code, use our HTML Formatter. To preview how HTML renders in a browser, try the HTML Viewer.
Frequently Asked Questions
What does HTML encoding do?
HTML encoding converts special characters like <, >, &, and quotes into HTML entity equivalents. This prevents browsers from interpreting those characters as markup, which is essential for displaying code and preventing XSS attacks.
What is the difference between HTML encode and decode?
Encoding converts characters to entities (for example < becomes <). Decoding does the reverse, converting entities back to their original characters. Encode when you need to display HTML as text. Decode when you need to read entity-encoded content.
Which characters need to be HTML encoded?
The five characters that must be encoded are: & (ampersand), < (less than), > (greater than), " (double quote), and ' (single quote). Optionally, non-ASCII characters can also be encoded using numeric entities.
Does this tool handle all HTML entities?
Yes. The decoder handles all named entities (like & ©), decimal numeric entities (like <), and hexadecimal entities (like <). The encoder converts the five required special characters and optionally encodes non-ASCII characters.
Is the HTML encoder and decoder free?
Yes. Completely free with no limits. No sign-up or account required. Just paste your text and click Encode or Decode.