HTML Encoder / Decoder
Encode and decode HTML entities online. Convert special characters to HTML entities for safe display in web pages.
Examples
Common HTML Entities Reference
| Character | Entity | Decimal | Description |
|---|---|---|---|
| < | < | < | Less than |
| > | > | > | Greater than |
| & | & | & | Ampersand |
| " | " | " | Double quote |
| ' | ' | ' | Single quote |
| |   | Non-breaking space | |
| © | © | © | Copyright |
| ® | ® | ® | Registered |
| ™ | ™ | ™ | Trademark |
| € | € | € | Euro sign |
| — | — | — | Em dash |
| – | – | – | En dash |
About HTML Encoder / Decoder
HTML encoding converts special characters like <, >, &, and " into their HTML entity equivalents. This is essential for displaying these characters in web pages without the browser interpreting them as HTML tags. It also helps prevent XSS (Cross-Site Scripting) attacks by neutralizing injected HTML and JavaScript.
Decoding reverses this process, converting HTML entities back to their original characters. This tool supports both named entities (like &) and numeric entities (like & and &).
All processing happens locally in your browser. No data is sent to any server.
How to Use This HTML Encoder / Decoder
This free online HTML encoder and decoder converts between raw text and HTML entities. Use it to safely display special characters in web pages or to decode HTML entities back to readable text:
- Choose encode or decode mode using the mode tabs at the top.
- Paste or type your text in the input area.
- View the result in the output area below. The conversion happens instantly.
- Copy the output using the copy button to use in your HTML, JavaScript, or other code.
Enable "Encode all characters" to convert every character to numeric entities, useful for email obfuscation and maximum compatibility.
Common Use Cases
- XSS prevention — Encode user input before displaying it in HTML to prevent cross-site scripting attacks.
- Code display — Encode HTML code snippets so they display as text rather than being rendered by the browser.
- XML/HTML documents — Ensure special characters in content do not break document structure.
- Email obfuscation — Encode email addresses using numeric entities to hide them from spam bots.
- API development — Decode HTML entities received from APIs or web scrapers back to readable text.
Related Tools
Frequently Asked Questions
What is HTML encoding?
HTML encoding converts special characters into their HTML entity equivalents so they display correctly in web pages. For example, < becomes <, > becomes >, and & becomes &. Without encoding, the browser would interpret these characters as HTML tags.
Why is HTML encoding important for security?
HTML encoding prevents Cross-Site Scripting (XSS) attacks. If user input is displayed on a web page without encoding, an attacker could inject malicious HTML or JavaScript code (like <script>alert('XSS')</script>). Encoding neutralizes these injections by converting < and > to their entity equivalents.
What is the difference between named and numeric entities?
Named entities use descriptive names like & for &, < for <, and © for the copyright symbol. Numeric entities use decimal (&#38;) or hexadecimal (&#x26;) character codes. Both produce the same result, but named entities are more readable.
When should I use HTML encoding?
You should encode text when displaying user-generated content on web pages, embedding text in HTML attributes, including special characters in XML/HTML documents, and when storing HTML content in databases or APIs that will later be rendered on web pages.
What does 'encode all characters' do?
The 'encode all characters' option converts every character to its numeric HTML entity (e.g., 'A' becomes A). This is useful for obfuscating email addresses to prevent spam bots, or for ensuring all characters are safely encoded regardless of the document's character encoding.
Is my text stored or sent to a server?
No. All encoding and decoding happens entirely in your browser using JavaScript. Your text never leaves your device and is not stored, logged, or transmitted anywhere.
Related Tools & Guides
Base64 Encoder / Decoder
Encode and decode Base64 strings online. Supports text and hex input with URL-safe Base64 option for Ethereum development.
URL Encoder / Decoder
Encode and decode URL components online. Compare encodeURIComponent vs encodeURI with a common URL encodings reference table.
Markdown Preview
Write markdown and see a live rendered preview side by side. Supports headers, bold, italic, code blocks, lists, links, and more.
Try Also
QR Code Generator
Generate QR codes from text, URLs, emails, or Wi-Fi credentials online. Customize colors, download as PNG. Free, client-side tool.
JSON to CSV Converter
Convert JSON arrays to CSV and CSV to JSON online. Supports custom delimiters, proper escaping, nested objects, and file download.
JWT Decoder
Decode JSON Web Tokens into header, payload, and signature. View claims, check expiration, and validate JWT structure.