HTML Entity preview

HTML Entity

Convert special characters to HTML entities and decode them back. Shows both named and numeric entity formats. Common entities reference table included.

Key features

  • Convert special characters to named HTML entities
  • Decode HTML entities back to characters
  • Shows both named (&) and numeric (&) entity formats
  • Common entities reference table included

Guide

HTML entities are text sequences that represent special characters in HTML documents. The ampersand character (&) cannot appear literally in HTML because it signals the start of an entity reference. The less-than sign (<) and greater-than sign (>) cannot appear literally because they define HTML tags. To display these characters on a web page, you use HTML entities: &amp; for &, &lt; for <, and &gt; for >. The HTML entity encoder/decoder tool converts between plain characters and their entity representations. The tool works in two directions. In encode mode, you paste text containing special characters, and the tool converts them to HTML entities. In decode mode, you paste text containing HTML entities, and the tool converts them back to the original characters. This bidirectional conversion is essential for web developers, content managers, and anyone who works with HTML. HTML entities come in two formats. Named entities use a readable name: &amp; for ampersand, &lt; for less-than, &copy; for the copyright symbol. Numeric entities use the character's Unicode code point: &#38; for ampersand, &#60; for less-than, &#169; for copyright. The tool shows both formats so you can use whichever your situation requires. The common entities reference table included in the tool lists the most frequently used HTML entities. This covers the five characters that must be encoded in HTML (ampersand, less-than, greater-than, double quote, single quote/apostrophe), plus commonly used symbols like copyright, registered trademark, degree, and currency signs. Having this reference available saves trips to external documentation. Encoding is necessary when you are inserting user-generated content into an HTML page. If a user enters text containing angle brackets and you insert it into your HTML without encoding, the browser may interpret it as HTML tags. This is not just a display problem. Unencoded user input is the root cause of cross-site scripting (XSS) vulnerabilities. Encoding special characters ensures they are displayed as text rather than executed as code. Decoding is necessary when you receive HTML-encoded text and need to see or use the original characters. API responses, database exports, and content management systems sometimes deliver text with entities already encoded. If you need to edit that text or display it in a non-HTML context, you need to decode the entities back to their original characters. The tool handles both common and obscure entities. Beyond the basic five, there are hundreds of named HTML entities covering mathematical symbols, Greek letters, arrows, currency signs, typographic characters, and more. The numeric entity format can represent any Unicode character, including emoji and characters from non-Latin scripts. The tool decodes all of these correctly. For web developers, the encoder is useful when building HTML strings in code. If you are constructing HTML in a template or script and need to include a literal ampersand or angle bracket in the output, running the text through the encoder gives you the correct entity. This is faster than remembering entity names and less error-prone than typing them manually. Content migration is another common use case. When moving content between systems (from a CMS to a static site, from one database to another), entities sometimes get double-encoded. The ampersand in &amp; gets encoded again to produce &amp;amp;, which displays as &amp; instead of & on the page. The decoder helps you identify and fix these issues by letting you decode iteratively until you reach the original characters. The tool is valuable for email development. HTML emails use entities extensively because email clients have inconsistent character encoding support. Using named or numeric entities for special characters ensures they display correctly across Outlook, Gmail, Apple Mail, and other clients. The encoder converts your special characters to entities that are safe to include in email HTML. JSON data embedded in HTML pages needs careful entity handling. JSON uses double quotes for strings, and if you embed JSON in an HTML attribute, those quotes must be encoded. The encoder handles this conversion. Similarly, if you extract JSON from HTML and it contains encoded quotes, the decoder restores them to actual quote characters so the JSON is valid. For SEO professionals, entity encoding matters in meta tags. The title tag, meta description, and Open Graph tags are HTML attributes. If your title or description contains characters like ampersands, they must be encoded in the HTML source. The tool encodes them correctly. The browser and search engines decode them automatically for display, so users and search results show the original characters. The ampersand is the most frequently encoded character because it appears in company names (AT&T), URLs with query parameters (/page?a=1&b=2), and common phrases (terms & conditions). Every instance in HTML needs encoding. Missing even one ampersand encoding can break the HTML parser and cause the rest of the page to render incorrectly. Quote encoding is critical for HTML attributes. If an attribute value is wrapped in double quotes and the value itself contains a double quote, the attribute ends prematurely. Encoding the inner quote as &quot; prevents this. The same applies to single quotes in attributes wrapped with single quotes, where the entity is &#39; or &apos;. The less-than and greater-than signs are essential to encode when displaying code examples on web pages. A tutorial that shows HTML code needs every < and > in the example to be encoded. Without encoding, the browser interprets the example code as actual HTML and tries to render it, which hides the code from the reader and potentially breaks the page layout. Unicode characters above the basic ASCII range are sometimes encoded as numeric entities for compatibility with older systems. The tool handles these conversions in both directions. If you receive text with numeric entities like &#8220; (left double quotation mark) or &#8364; (euro sign), the decoder converts them to their visual characters. If you need to encode characters for a system that does not support UTF-8, the encoder produces the numeric entities. The tool processes text of any length. You can paste an entire HTML document into the decoder to see what all the entities resolve to. You can paste a long article into the encoder to prepare it for safe HTML insertion. Processing happens in your browser with no server round-trip, so there is no size limit beyond your device's memory. For developers debugging display issues, the tool helps identify what went wrong. If a web page shows &amp; instead of &, the text has been double-encoded. Paste it into the decoder once to get &amp;, paste that result again to get &. This tells you that one encoding step needs to be removed from the pipeline. The tool's ability to decode iteratively makes this debugging process straightforward. Security-focused developers use entity encoding as part of output sanitization. When building a web application, every piece of dynamic content inserted into HTML should pass through an entity encoder. The tool demonstrates what this encoding looks like and can verify that your application's encoding function produces correct output. Comparing your application's encoded output against the tool's output reveals any discrepancies. The tool also serves as an educational resource. New web developers learning HTML need to understand why entities exist and when to use them. The reference table and the interactive encode/decode functionality provide a hands-on way to learn. Type a character, see its entity, and understand the relationship. This builds intuition faster than reading documentation alone. Beyond the five mandatory entities, several others appear frequently in professional web development. The non-breaking space (&nbsp;) prevents line breaks between two words. The en dash (&ndash;) and em dash (&mdash;) provide typographically correct dashes. The ellipsis (&hellip;) produces three dots as a single character. The bullet (&bull;) creates a round bullet point. Knowing these entities and having them in the reference table speeds up HTML authoring. Currency symbols are another category where entities are useful. The euro sign (&euro;), pound sign (&pound;), yen sign (&yen;), and cent sign (&cent;) all have named entities. Using these entities instead of pasting the literal characters ensures they display correctly even on systems with limited character encoding. The reference table in the tool includes these and other common currency entities. The tool supports hexadecimal numeric entities as well as decimal. A character can be represented as &#60; (decimal) or &#x3C; (hexadecimal). Both refer to the same character (less-than sign). The decoder handles both formats. Hexadecimal entities are common in auto-generated HTML and in code that constructs entity references programmatically. For WordPress developers, entity issues are common when switching between the visual editor and the text editor. The visual editor sometimes double-encodes entities that were already present in the HTML. The tool helps diagnose these problems. Paste the affected text into the decoder and count how many decode passes it takes to reach the original character. Each extra pass represents one unnecessary encoding step in the WordPress pipeline. Internationalization (i18n) workflows benefit from the entity encoder when preparing content for systems that do not handle UTF-8 well. Some older content delivery networks, email platforms, and legacy databases work better with ASCII-safe content where non-ASCII characters are represented as numeric entities. The encoder converts these characters to their entity form, making the content safe for those systems while preserving the intended characters. RSS and Atom feeds require careful entity handling. Feed readers interpret the XML in the feed, and XML has the same entity requirements as HTML for the five mandatory characters. In addition, CDATA sections in feeds can contain unencoded HTML, which then needs its own entity encoding. The tool helps feed developers verify that their content is properly encoded at each level. For accessibility testing, entity encoding matters in alt text attributes and ARIA labels. If an image alt text contains special characters, those characters must be encoded in the HTML source for the alt attribute to render correctly in screen readers. The tool lets you verify the encoding before deploying, which catches issues that visual testing would miss. The reference table in the tool is organized by category: essential entities, currency, mathematical, Greek, arrows, and typographic. This organization makes it easy to find the entity you need without scrolling through an alphabetical list. If you need a right arrow, go to the arrows category. If you need a Greek letter for a mathematical formula displayed in text, go to the Greek category. The tool also handles named entities that were introduced in HTML5. Earlier versions of HTML supported a smaller set of named entities. HTML5 expanded this to over 2,000 named references covering a wide range of mathematical, technical, and typographic characters. The decoder recognizes all of these, including less common ones like &heartsuit;, &clubsuit;, and &phone;. For Markdown-based systems, entity handling works differently. Markdown processors like those used in GitHub README files, Jekyll blogs, and Notion pages handle some entities but not all. If you are writing Markdown and need to display a special character, test whether the Markdown processor handles the entity before deploying. The tool helps you generate the entity so you can paste it into your Markdown and check the preview. Database administrators encounter entity issues when importing and exporting data. A CSV export from a web application might contain HTML entities in text fields. When importing this data into a new system, the entities need to be decoded to their original characters. The tool helps identify which entities are present and what they decode to, which informs the data migration script. For API developers, entity handling is part of the content negotiation process. An API that returns HTML-encoded content expects the client to decode the entities for display. If your API returns JSON with entity-encoded strings, the tool helps you verify that the encoding is correct and that the intended characters can be recovered through decoding. The tool is particularly helpful when dealing with multilingual content. Characters like the German umlaut, French accent grave, Spanish tilde, and Scandinavian ring are often encoded as numeric entities in older systems. The decoder reveals the actual characters, and the encoder produces the entities needed for systems that require them. For static site generators like Hugo, Eleventy, and Gatsby, entity issues arise when content includes special characters in front matter or template variables. A title like "Tom & Jerry" in a YAML front matter field might need to be "Tom &amp; Jerry" in the generated HTML. The tool helps verify these conversions during site development. Web scraping projects frequently need entity decoding. When you scrape text content from a web page, the extracted text often contains HTML entities because you are reading the HTML source, not the rendered output. Running the scraped text through the decoder converts it to readable characters for storage in your database or display in your application. For PDF generation from HTML, entity encoding ensures that special characters appear correctly in the final PDF. Many HTML-to-PDF libraries process entities correctly, but some have bugs with obscure entities. Testing your HTML content in the tool first identifies any entities that might cause problems in the PDF output. For content management systems like WordPress, Drupal, and Joomla, entity encoding issues are among the most common content display bugs. When editors paste content from Microsoft Word or Google Docs into a CMS rich text editor, the smart quotes, em dashes, and special characters from the word processor are sometimes converted to entities and sometimes left as raw characters. If the CMS applies its own encoding on top, you get double-encoded entities. The tool helps untangle these issues by showing exactly what each entity decodes to. The entity encoder is also useful for generating test data. QA engineers testing web forms need to verify that special characters are handled correctly. Pasting encoded and decoded versions of test strings into form fields reveals whether the application handles entities at each stage of processing. The tool generates these test strings quickly. For AMP (Accelerated Mobile Pages) development, entity encoding is critical because AMP has strict validation rules. Invalid entities or unencoded characters in AMP HTML cause validation failures, which prevent the page from being served from Google's AMP cache. Running your AMP content through the encoder before deployment catches encoding issues that the AMP validator would flag. SVG files embedded in HTML require entity encoding for text elements. If an SVG text element contains an ampersand or angle bracket, it must be encoded for the SVG to render correctly. The tool encodes these characters, and you can paste the result directly into your SVG markup. For developers building browser extensions, entity handling matters when injecting content into web pages. The extension's injected HTML must have properly encoded entities to avoid breaking the host page's DOM. The tool helps verify that the injected content is safe and correctly encoded before testing it in the browser. The tool's decode mode is useful for reading obfuscated or encoded email addresses in web page source code. Some websites encode email addresses as numeric entities to prevent spam bots from scraping them. Pasting &#106;&#111;&#104;&#110;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109; into the decoder reveals the original email address. This technique demonstrates how entity encoding can serve as basic obfuscation. For technical writers creating documentation that includes code samples, the tool is part of the workflow. Every code sample that shows HTML, XML, or any angle-bracket syntax needs entity encoding in the HTML source of the documentation page. The tool converts the raw code to entity-encoded text that displays correctly as a code example rather than being interpreted as markup. Character encoding issues are among the top reasons for garbled text on web pages. The tool helps diagnose these issues by letting you test whether a character displays correctly in its entity form. If the entity decodes correctly in the tool but displays wrong on your page, the problem is in the page's character encoding declaration, not in the entity itself. This narrows down the debugging scope significantly. For teams maintaining large codebases, entity encoding issues often surface during code reviews. A reviewer spots &amp;amp; in a template and recognizes the double encoding. The tool helps the developer verify the fix by decoding the string and confirming that only one level of encoding remains. This makes code reviews faster and more accurate. The tool is equally useful for one-off tasks and repeated workflows. A developer who encodes entities once a month and a content manager who decodes entities daily both benefit from the same interface. There is no subscription tier, no usage limit, and no feature gating. The full functionality is available from the first visit. For developers working with server-side rendering frameworks like Next.js, Nuxt, or SvelteKit, entity encoding is handled automatically in most cases. However, when you inject raw HTML using dangerouslySetInnerHTML or equivalent methods, you bypass the framework's encoding. The tool helps you pre-encode the raw HTML to ensure it is safe before injection. The tool complements browser developer tools. When inspecting an element in Chrome DevTools, you see the rendered text, not the entity-encoded source. If you need to see the entities, view the page source. If the source shows entities and you want to know what they represent, paste them into the tool's decoder. This bridge between source view and rendered view speeds up debugging.

Frequently asked questions

Why do I need HTML entities?

Characters like <, >, & have special meaning in HTML. Entities prevent them from being interpreted as code.

What is the difference between named and numeric entities?

Named entities use words (&amp;), numeric use code points (&#38;). Both work, but named are more readable.

Related guides

Related WebRecast sections