HTML Entity Encoder / Decoder
Encode special characters into HTML entities or decode HTML entities back to readable text. Supports named entities (&), decimal (&), and hexadecimal (&) formats.
How to Use the HTML Entity Encoder / Decoder
HTML entities are essential for web development, email template design, and content management. Any time you need to display characters that HTML reserves for its own syntax — angle brackets for tags, ampersands for entity references, and quotes for attribute values — you must encode them as entities. This free online tool makes the conversion instant and error-free, handling named entities, decimal numeric entities, and hexadecimal numeric entities in both directions.
- Choose your mode: Click the "Encode" tab to convert raw text to HTML entities, or the "Decode" tab to convert entities back to readable text.
- Enter your text: Type or paste content into the input textarea. For encoding, enter raw text containing special characters. For decoding, paste HTML with entity codes.
- Click Convert: The tool processes your input and displays the result in the output area. Use the copy button to place the result on your clipboard.
Common HTML Entities Reference
| Character | Named Entity | Decimal | Hexadecimal | Description |
|---|---|---|---|---|
| & | & | & | & | Ampersand |
| < | < | < | < | Less than |
| > | > | > | > | Greater than |
| " | " | " | " | Double quote |
| ' | ' | ' | ' | Apostrophe |
|   |   | Non-breaking space | |
| © | © | © | © | Copyright |
| — | — | — | — | Em dash |
When to Encode HTML Entities
Always encode user-generated content before inserting it into HTML to prevent cross-site scripting (XSS) attacks. Encoding is also essential when writing HTML inside HTML attributes, embedding code snippets in blog posts, creating email newsletter templates, or generating HTML from server-side code. Failing to encode special characters can break your page layout or create security vulnerabilities. This tool helps you quickly verify the encoded output before integrating it into your project.
Named vs Numeric Entities
Named entities like & and < are the most readable and widely supported for common characters. However, only about 250 characters have named entities defined in the HTML specification. Numeric entities — both decimal (—) and hexadecimal (—) — can represent any Unicode character, making them useful for special symbols, emojis, and characters from non-Latin scripts. This tool uses named entities where available and falls back to numeric entities for other characters.
Frequently Asked Questions
What are HTML entities and why do I need them?
HTML entities are special codes that represent characters which have a reserved meaning in HTML, such as < (less than), > (greater than), & (ampersand), and " (double quote). If you include these raw characters in your HTML, the browser may interpret them as tags or syntax. Encoding them as entities like <, >, and & ensures they display correctly as text.
What is the difference between named and numeric entities?
Named entities use a human-readable name like & for the ampersand character. Numeric entities use the character's Unicode code point — either in decimal (&) or hexadecimal (&) form. All three encode the same character. Named entities are easier to read but not every character has a named entity, so numeric entities cover the full Unicode range.
How do I encode HTML entities?
Paste or type your text in the input area with the Encode tab active. The tool replaces characters like <, >, &, ", and ' with their corresponding HTML entities. The output is safe to embed directly in HTML source code.
How do I decode HTML entities?
Switch to the Decode tab and paste HTML-encoded text. The tool converts all named, decimal, and hexadecimal entities back to their original characters so you can read the underlying text.
Does this tool handle all Unicode characters?
Yes. The encoder converts any character outside the basic ASCII printable range to its numeric entity, and the decoder handles any valid numeric entity — decimal or hexadecimal — across the full Unicode range.