List of XML and HTML character entity references explained

In SGML, HTML and XML documents, the logical constructs known as character data and attribute values consist of sequences of characters, in which each character can manifest directly (representing itself), or can be represented by a series of characters called a character reference, of which there are two types: a numeric character reference and a character entity reference. This article lists the character entity references that are valid in HTML and XML documents.

A character entity reference refers to the content of a named entity. An entity declaration is created in XML, SGML and HTML documents (before HTML5) by using the <!ENTITY name "value"> syntax in a Document type definition (DTD).

Character reference overview

In HTML and XML, a numeric character reference refers to a character by its Universal Character Set/Unicode code point, and uses the format:

&amp;#x''hhhh'';or

&amp;#''nnnn'';where the x must be lowercase in XML documents, hhhh is the code point in hexadecimal form, and nnnn is the code point in decimal form. The hhhh (or nnnn) may be any number of hexadecimal (or decimal) digits and may include leading zeros. The hhhh for hexadecimal digits may mix uppercase and lowercase letters, though uppercase is the usual style. However the XML and HTML standards restrict the usable code points to a set of valid values, which is a subset of UCS/Unicode code point values, that excludes all code points assigned to non-characters or to surrogates, and most code points assigned to C0 and C1 controls (with the exception of line separators and tabulations treated as white spaces).

In contrast, a character entity reference refers to a sequence of one or more characters by the name of an entity which has the desired characters as its replacement text. The entity must either be predefined (built into the markup language), or otherwise explicitly declared in a Document Type Definition (DTD) (see). The format is the same as for any entity reference:

&''name'';where name is the case-sensitive name of the entity. The semicolon is usually required in the character entity reference, unless marked otherwise in the table below (see).

Standard public entity sets for characters

XML: XML specifies five predefined entities needed to support every printable ASCII character: &amp;amp;, &amp;lt;, &amp;gt;, &amp;apos;, and &amp;quot;. The trailing semicolon is mandatory in XML (and XHTML) for these five entities (even if HTML or SGML allows omitting it for some of them, according to their DTD).
  • ISO Entity Sets: SGML supplied a comprehensive set of entity declarations for characters widely used in Western technical and reference publishing, for Latin, Greek and Cyrillic scripts. The American Mathematical Society also contributed entities for mathematical characters (see).
  • HTML Entity Sets: Early versions of HTML built in small subsets of these, relating to characters found in three Western 8-bit fonts.
  • MathML Entity Sets: The W3C developed a set of entity declarations for MathML characters.
  • XML Entity Sets: The W3C MathML Working Group took over maintenance of the ISO public entity sets, combined with the MathML and documents them in XML Entity Definitions for Characters. This set can support the requirements of XHTML, MathML and as an input to future versions of HTML.
  • HTML5: HTML5 adopts the XML entities as named character references, however it restates them without reference to their sources and does not group them into sets. The HTML5 specification additionally provides mappings from the names to Unicode character sequences using JSON.
  • Numerous other entity sets have been developed for special requirements, and for major and minority scripts. However, the advent of Unicode has largely superseded them.

    Formal public identifiers for HTML DTD entities subsets

    The full formal public identifier and system identifier for the DTD entities subset (where the character entity name is defined) is actually mapped from one of the following three defined named entities:

    HTML DTD entities subsets
    NameVersionFormal public identifierSystem identifier
    HTMLlat1HTML 4"-//W3C//ENTITIES Latin 1//EN//HTML""<span class="plainlinks">http://www.w3.org/TR/html4/HTMLlat1.ent</span>" (optional)
    XHTML 1"-//W3C//ENTITIES Latin 1 for XHTML//EN""<span class="plainlinks">http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent</span>"
    HTMLsymbolHTML 4"-//W3C//ENTITIES Symbols//EN//HTML""<span class="plainlinks">http://www.w3.org/TR/html4/HTMLsymbol.ent</span>" (optional)
    XHTML 1"-//W3C//ENTITIES Symbols for XHTML//EN""<span class="plainlinks">http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent</span>"
    HTMLspecialHTML 4"-//W3C//ENTITIES Special//EN//HTML""<span class="plainlinks">http://www.w3.org/TR/html4/HTMLspecial.ent</span>" (optional)
    XHTML 1"-//W3C//ENTITIES Special for XHTML//EN""<span class="plainlinks">http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent</span>"
    html.dtdN/A"<span class="plainlinks">http://info.cern.ch/MarkUp/html-spec/html.dtd</span>"
    HTML 5"-//W3C//ENTITIES HTML MathML Set//EN//XML""<span class="plainlinks">http://www.w3.org/2003/entities/2007/htmlmathml-f.ent</span>"

    Formal public identifiers for old ISO entities subsets

    The ISO entities subsets are old (documented) character subsets, which are given SGML character entity names in ISO 8879 and ISO 9573, and which were used in legacy encodings before the unification within ISO 10646. Their full formal public identifiers are as follows:

    ISO entities subsets
    NameFormal public identifier(s)
    ISOamsa
      ISOamsb
        ISOamsc
          ISOamsn
            ISOamso
              ISOamsr
                ISObox
                ISOchem
                ISOcyr1
                ISOcyr2
                ISOdia
                ISOgrk1
                ISOgrk2
                ISOgrk3
                  ISOgrk4
                    ISOlat1
                    ISOlat2
                    ISOmfrk
                    ISOmopf
                    ISOmscr
                    ISOnum
                    ISOpub
                    ISOtech

                      List of character entity references in HTML

                      HTML5 defines many named entities, references to which act as mnemonic aliases for certain Unicode characters.[1] The HTML5 specification does not allow users to define additional entities, as it no longer accepts any DTD to be referenced or extended inside HTML documents (this is still needed in XHTML, which is based on stricter XML parsing rules but allows referencing or defining a DTD in the document header, because XML does not predefine most HTML entities).

                      In the below table, the "Standard" column indicates the first version of the HTML DTD that defines the character entity reference, and indicates characters that are predefined in XML without needing any DTD. To use one of these character entity references in an HTML or XML document, enter an ampersand (&) followed by the entity name, and a semicolon (mandatory in XML, and strongly recommended in HTML for all entities, even if HTML allows omitting the semicolon only from some entities indicated below by), e.g., enter &amp;copy; for the copyright symbol .

                      There are no predefined character entities in HTML for characters or sequences of most scripts encoded in the UCS (except a common subset of whitespace, punctuation, mathematical or technical symbols, currency symbols, a few Hebrew symbols used in mathematical notations, and the most common letters in Latin, Greek or Cyrillic). Note also that not all bidirectional controls defined in UCS/Unicode are represented as standard character entities in HTML (not even in HTML5, which defines more general directional elements and attributes for that purpose). Notably, there are no predefined HTML character entities for controls that were added in the UCS/Unicode and formally defined in version 2 of the Unicode Bidi Algorithm.

                      Most entities are predefined in XML and HTML to reference just one character in the UCS, but there are no predefined entities for isolated combining characters, variation selectors, or characters for private use assignments; however the list includes some predefined entities for character sequences of two characters containing some of them. Since HTML 5.0 (and MathML 3.0 which shares the same set en entities), all entities are encoded in Unicode normalization forms C and KC (this was not the case with older versions of HTML and MathML, so older entities that were initially defined with characters for private use assignments, CJK compatibility forms, or in non-NFC forms were modified[2]).

                      However, all valid characters and sequences in the UCS, including all bidirectional controls or private-use assignments (but with the exception of non-whitespace C0 and C1 controls, non-characters, and surrogates) are also usable and valid in HTML, XML, XHTML and MathML, either in plain-text values of attributes or in text elements (by encoding them directly as plain text, or using numeric character references when needed).

                      All named character entity references in HTML and XML! scope="col"
                      EntitiesCodepointsStandardDTDOld ISO subsetDescription
                      data-sort-value=" " TABdata-sort-value="0:0:0:0:0:9" U+0009HTML 5.0character tabulation (TAB)
                      data-sort-value=" " LFdata-sort-value="0:0:0:0:0:A" U+000AHTML 5.0line feed (LF)
                       ̑data-sort-value="0:0:0:0:2:0 0:0:0:3:1:1" U+0020 U+0311
                      U+0311
                      combining inverted breve (combining down breve)
                       &#x20DB;data-sort-value="0:0:0:0:2:0 0:0:2:0:D:B" U+0020 U+20DB
                      U+20DB
                      combining three dots above
                       &#x20DC;data-sort-value="0:0:0:0:2:0 0:0:2:0:D:C"
                      U+20DC
                      combining four dots above
                      !data-sort-value="0:0:0:0:2:1" U+0021HTML 5.0ISOnumexclamation mark

                      "data-sort-value="0:0:0:0:2:2" U+0022html.dtd
                      HTMLspecial
                      ISOnumquotation mark
                      data-sort-value="0:0:0:0:2:3" U+0023HTML 5.0ISOnumnumber sign
                      $data-sort-value="0:0:0:0:2:4" U+0024HTML 5.0ISOnumdollar sign
                      %data-sort-value="0:0:0:0:2:5" U+0025HTML 5.0ISOnumpercent sign

                      &data-sort-value="0:0:0:0:2:6" U+0026html.dtd
                      HTMLspecial
                      ISOnumampersand
                      'data-sort-value="0:0:0:0:2:7" U+0027XML 1.0HTMLspecialISOnumapostrophe (apostrophe-quote); see below
                      (data-sort-value="0:0:0:0:2:8" U+0028HTML 5.0ISOnumleft parenthesis
                      )data-sort-value="0:0:0:0:2:9" U+0029HTML 5.0ISOnumright parenthesis

                      data-sort-value="0:0:0:0:2:A" U+002AHTML 5.0ISOnumasterisk (middle asterisk)
                      +data-sort-value="0:0:0:0:2:B" U+002BHTML 5.0ISOnumplus sign
                      ,data-sort-value="0:0:0:0:2:C" U+002CHTML 5.0ISOnumcomma
                      .data-sort-value="0:0:0:0:2:E" U+002EHTML 5.0ISOnumfull stop (period)
                      /data-sort-value="0:0:0:0:2:F" U+002FHTML 5.0ISOnumsolidus
                      data-sort-value="0:0:0:0:3:A" U+003AHTML 5.0ISOnumcolon
                      data-sort-value="0:0:0:0:3:B" U+003BHTML 5.0ISOnumsemicolon

                      <data-sort-value="0:0:0:0:3:C" U+003Chtml.dtd
                      HTMLspecial
                      ISOnumless-than sign
                      <⃒data-sort-value="0:0:0:0:3:C 0:0:2:0:D:2" U+003C U+20D2HTML 5.0ISOamsnless-than sign, combining long vertical line overlay
                      =data-sort-value="0:0:0:0:3:D" U+003DHTML 5.0ISOnumequals sign
                      =⃥data-sort-value="0:0:0:0:3:D 0:0:2:0:E:5" U+003D U+20E5HTML 5.0ISOtechequals sign, combining reverse solidus overlay

                      >data-sort-value="0:0:0:0:3:E" U+003Ehtml.dtd
                      HTMLspecial
                      ISOnumgreater-than sign
                      >⃒data-sort-value="0:0:0:0:3:E 0:0:2:0:D:2" U+003E U+20D2HTML 5.0ISOamsngreater-than sign, combining long vertical line overlay
                      ?data-sort-value="0:0:0:0:3:F" U+003FHTML 5.0ISOnumquestion mark
                      @data-sort-value="0:0:0:0:4:0" U+0040HTML 5.0ISOnumcommercial at
                      [| data-sort-value="0:0:0:0:5:B" | [[Basic Latin (Unicode block)|U+]]005B| HTML 5.0| | ISOnum| left square bracket (left bracket)|-| | \| data-sort-value="0:0:0:0:5:C" | U+005C| HTML 5.0| | ISOnum| reverse solidus (backward solidus)|-| | ]data-sort-value="0:0:0:0:5:D" U+005DHTML 5.0ISOnumright square bracket (right bracket)
                      ^data-sort-value="0:0:0:0:5:E" U+005EHTML 5.0circumflex accent (hat)
                      _data-sort-value="0:0:0:0:5:F" U+005FHTML 5.0ISOnumlow line (low bar; &underbar)
                      `data-sort-value="0:0:0:0:6:0" U+0060HTML 5.0ISOdiagrave accent (diacritical grave)
                      fjdata-sort-value="0:0:0:0:6:6 0:0:0:0:6:A" U+0066 U+006AHTML 5.0ISOpublatin small letter f, latin small letter j

                      Notes and References

                      1. Web site: HTML5 Named Character Reference List .
                      2. Web site: XML Entity Definitions for Characters (3rd Edition) - § C Differences between these entities and earlier W3C DTDs.