This HTML entity encoder and decoder converts special characters like less-than signs, greater-than signs, ampersands and quotes into their HTML entity equivalents and vice versa. It supports both named entities like amp and numeric entities like #60. The tool also handles non-ASCII characters by converting them to numeric entities. Everything runs in your browser so your text is never sent to any server. Use it to safely display code snippets, prevent XSS attacks or debug HTML content.
Enter your values to see the result.
<div class="test">Hello & World</div> → <div class="test">Hello & World</div>
Angle brackets and quotes are encoded to prevent HTML interpretation.
<p>Bonjour le monde</p> → <p>Bonjour le monde</p>
Named HTML entities are decoded back to their original characters.
café résumé naïve → café résumé naïve
Non-ASCII characters with accents are converted to numeric entities.
HTML entities are special character codes that allow you to represent characters in HTML that would otherwise be interpreted as markup or that cannot be easily typed on a standard keyboard. Every entity follows the same pattern: an ampersand at the start, followed by either a name or a number, and terminated by a semicolon. The two main types are named entities like & for an ampersand and < for a less-than sign, and numeric entities like & and < which use the Unicode code point number.
The HTML5 specification defines 253 named entities that cover the most commonly needed special characters. These include the five characters that must always be escaped in HTML text content — ampersand, less-than, greater-than, double quote and apostrophe — as well as typographic characters like em dashes, curly quotes and ellipses, mathematical symbols, Greek letters used in scientific notation, and common symbols like copyright, registered trademark and currency signs. For characters outside this set, numeric entities provide universal coverage of the entire Unicode range.
This HTML entity encoder and decoder provides two modes of operation. In encode mode, the tool scans your input text character by character and replaces every character that has special meaning in HTML with its corresponding entity. The five mandatory HTML entities — ampersand, less-than, greater-than, double quote and single quote — are always encoded. Optionally, non-ASCII characters can also be converted to their numeric entity equivalents for maximum compatibility across different character encodings.
In decode mode, the tool scans for entity patterns — both named entities like & and numeric entities like < or < — and replaces each one with the corresponding character. The decoder handles both decimal and hexadecimal numeric entities and correctly processes all 253 named entities defined in HTML5. The result is plain text with all entities resolved back to their original characters.
Web developers use HTML entity encoding constantly when building secure web applications. Any time user input is displayed on a web page, it must be entity-encoded to prevent cross-site scripting attacks where malicious users inject script tags or event handlers through form fields. Entity encoding neutralizes these attacks by converting dangerous characters into harmless text that displays correctly without being interpreted as HTML or JavaScript.
Content management systems and blogging platforms also rely on entity encoding when storing and displaying content. Code examples embedded in articles must have their angle brackets and ampersands encoded so they display as code rather than being parsed as HTML tags. Email templates often require entity encoding for special characters that might not survive transit through different mail servers and email clients with varying character encoding support.
All encoding and decoding operations happen locally in your browser using JavaScript string manipulation functions. Your text is never sent to any server, never stored in any database, and never processed by any third party. The encoding and decoding operations execute in microseconds regardless of input length, so even large blocks of text are processed instantly without any noticeable delay. The tool works offline once the page is loaded, making it suitable for use in any environment regardless of network availability.
HTML entities are special codes used to represent characters that have a specific meaning in HTML or that cannot be easily typed on a keyboard. They begin with an ampersand and end with a semicolon. Named entities use descriptive names like amp for an ampersand, lt for a less-than sign and gt for a greater-than sign. Numeric entities use the character's Unicode code point number like #60 for a less-than sign or #233 for the letter e with acute accent. Entities are essential for displaying reserved characters as visible text rather than having them interpreted as HTML markup.
HTML entity encoding is essential for security and correctness when displaying user-generated content on web pages. Characters like less than, greater than and ampersand have special meaning in HTML and can be used in cross-site scripting attacks to inject malicious scripts. By encoding these characters as entities, you ensure they are displayed as visible text rather than being interpreted as HTML tags or attributes. Entity encoding is also necessary when you need to display code examples, XML content or any text that contains characters that would otherwise be parsed as markup by the browser.
Named entities use human-readable names like amp for ampersand, quot for quotation mark, nbsp for non-breaking space and copy for the copyright symbol. There are 253 named entities defined in the HTML5 specification. Numeric entities use the Unicode code point number preceded by a hash sign, like #38 for ampersand or #169 for the copyright symbol. Numeric entities can represent any Unicode character while named entities only cover a limited set. Both types produce identical rendered output in browsers, but numeric entities are more universal for non-ASCII characters that lack a named entity equivalent.
Yes, this tool can encode any Unicode character as a numeric HTML entity. Characters outside the basic ASCII range, such as accented letters, CJK characters, emoji and mathematical symbols, are all converted to their corresponding numeric entity representation. The tool correctly handles characters in the supplementary planes that require surrogate pairs in UTF-16 encoding. When decoding, the tool recognizes both named entities and numeric entities and converts them back to the original Unicode characters regardless of the character set or encoding of the original text.
No, all encoding and decoding operations happen entirely in your browser using JavaScript. Your text is never transmitted over the network, never stored in any database, and never processed by any third party. You can safely encode or decode any text content including sensitive data, code snippets or confidential documents without any risk of the content being exposed or logged on a remote server. The tool works perfectly even without an internet connection once the page has loaded in your browser.
Last updated on 2026-09-26 · Written by UtiliaTools