What is HTML Entity?

HTML Entity (HTML Character Entity) is a string that begins with an ampersand (&) and ends with a semicolon (;), used to represent special characters in HTML that would otherwise be interpreted as HTML code or are not easily typed on a keyboard.

Quick Facts

Full NameHTML Character Entity
Created1993 (with HTML specification)
SpecificationOfficial Specification

How HTML Entity Works

HTML entities allow web developers to display reserved characters like <, >, &, and " that have special meanings in HTML markup. They also enable the display of characters not available on standard keyboards, such as copyright symbols (©), mathematical symbols (±), and characters from other languages. Entities can be written as named references (like &amp;) or numeric references using decimal (&#38;) or hexadecimal (&#x26;) codes. The HTML5 specification defines over 2,000 named character references.

Key Characteristics

  • Starts with & and ends with ; (e.g., &amp;)
  • Named entities use descriptive names (e.g., &copy;)
  • Numeric entities use decimal (&#169;) or hex (&#xA9;) codes
  • Required for displaying reserved HTML characters
  • Case-sensitive for named entities
  • Over 2,000 named entities defined in HTML5

Common Use Cases

  1. Displaying HTML reserved characters (<, >, &, ", ')
  2. Inserting special symbols (©, ®, ™, €)
  3. Adding non-breaking spaces (&nbsp;)
  4. Displaying mathematical symbols (±, ×, ÷)
  5. Including characters from other languages

Example

<!-- Reserved Characters -->
&lt;     = <     (less than)
&gt;     = >     (greater than)
&amp;    = &     (ampersand)
&quot;   = "     (double quote)
&apos;   = '     (apostrophe)

<!-- Common Symbols -->
&copy;   = ©     (copyright)
&reg;    = ®     (registered)
&trade;  = ™     (trademark)
&nbsp;   = (non-breaking space)

<!-- Numeric Entities -->
&#169;   = ©     (decimal)
&#xA9;   = ©     (hexadecimal)

<!-- Usage in HTML -->
<p>5 &lt; 10 &amp;&amp; 10 &gt; 5</p>

Related Tools on QubitTool

Related Concepts