Convert special characters to HTML entities and decode them back. Supports named and numeric entity references.
HTML entity encoding is the process of converting special characters in HTML into their corresponding entity references. Characters like < (less-than), > (greater-than), & (ampersand), and " (double quote) have special meanings in HTML markup. When you want to display these characters as literal text rather than having them interpreted as code, you must use their entity equivalents. HTML entities come in two forms: named entities like < for the less-than symbol, and numeric entities like < which use the Unicode code point. Decoding reverses this process, converting entity references back into the actual displayable characters. This tool handles both encoding and decoding for you, supporting a comprehensive range of standard HTML entities.
Using our HTML entity encoder and decoder is completely straightforward. To encode text, paste or type your input containing special HTML characters such as <, >, &, or quotes into the input field, then click the "Encode" button. The tool will instantly convert all special characters into their named entity equivalents. To decode, paste text containing HTML entities like <, >, or & into the input field and click "Decode". The output area will show the converted result. Use the "Copy" button to copy the result to your clipboard, and "Clear" to reset both fields. All processing happens locally in your browser, keeping your data private and secure at all times.
Our HTML entity encoder and decoder saves you time and eliminates guesswork when working with HTML content. Manually converting special characters is tedious and error-prone, especially when dealing with large blocks of code, user-generated content, or multilingual text. This tool handles all standard named entities as well as numeric character references with perfect accuracy. It is particularly valuable for web developers who need to safely display code snippets on their websites, content management system (CMS) users who frequently paste formatted text, and email template designers who must ensure cross-client compatibility. The tool runs entirely in your browser with zero server interaction, so your content never leaves your computer.
© for the copyright symbol are more readable in source code than numeric equivalents like ©. Use named entities whenever a reference is available.& to produce valid HTML. This is one of the most common validation errors.| Character | Description | Named Entity | Numeric Entity |
|---|---|---|---|
| < | Less-than | < | < |
| > | Greater-than | > | > |
| & | Ampersand | & | & |
| " | Double quote | " | " |
| ' | Apostrophe | ' | ' |
| © | Copyright | © | © |
| ® | Registered | ® | ® |
Named entities use a mnemonic name like < for the less-than character, making them easier to remember and more readable in source code. Numeric entities use the Unicode code point in decimal (<) or hexadecimal (<) format. Named entities are only available for commonly used characters, while numeric entities can represent any Unicode character.
It depends on your document's character encoding. If your HTML page uses UTF-8 (the modern standard), you can include accented characters directly without encoding. However, if you are working with older systems that use ASCII-only encoding, or if you want maximum compatibility, encoding them as entities is a safe practice.
Yes, HTML entity encoding is one of the most important defenses against cross-site scripting (XSS) attacks. By encoding special characters like <, >, and & before inserting user-supplied data into a web page, you prevent attackers from injecting malicious scripts that the browser might execute.
If you run the encode function on text that already contains HTML entities, the ampersand character in those entities will itself be encoded. For example, < would become &lt;, which will display as the literal text < instead of the less-than symbol. Always work with plain text when encoding.