List of XML and HTML character entity references

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.

Character reference overview
A numeric character reference refers to a character by its Universal Character Set/Unicode code point, and uses the format


 * nnnn

or
 * hhhh

where nnnn is the code point in decimal form, and hhhh is the code point in hexadecimal form. The x must be lowercase in XML documents. The nnnn or hhhh may be any number of digits and may include leading zeros. The hhhh may mix uppercase and lowercase, though uppercase is the usual style.

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


 * name

where name is the name of the entity. The semicolon is required.

Predefined entities in XML
The XML specification does not use the term "character entity" or "character entity reference". The XML specification defines five "predefined entities" representing special characters, and requires that all XML processors honor them. The entities can be explicitly declared in a DTD, as well, but if this is done, the replacement text must be the same as the built-in definitions. XML also allows other named entities of any size to be defined on a per-document basis.

The table below lists the five XML predefined entities. The "Name" column mentions the entity's name. The "Character" column shows the character, if it is renderable. In order to render the character, the format  is used; for example,   renders as &amp;. The "Unicode code point" column cites the character via standard UCS/Unicode "U+" notation, which shows the character's code point in hexadecimal. The decimal equivalent of the code point is then shown in parentheses. The "Standard" column indicates the first version of XML that includes the entity. The "Description" column cites the character via its canonical UCS/Unicode name, in English.

Character entity references in HTML
The HTML 4 DTDs define 252 named entities, references to which act as mnemonic aliases for certain Unicode characters. The HTML 4 specification requires the use of the standard DTDs and does not allow users to define additional entities.

In the table below, the "Standard" column indicates the first version of the HTML DTD that defines the character entity reference. HTML 4.01 did not provide any new character references.

Notes:
 * DTD: the full public DTD name (where the character entity name is defined) is actually mapped from one of the following three defined named entities:
 * HTMLlat1: maps to:
 * PUBLIC "-//W3C//ENTITIES Latin 1//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
 * PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent " in XHTML 1.0;
 * HTMLsymbol: maps to:
 * PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
 * PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent " in XHTML 1.0;
 * HTMLspecial: maps to:
 * PUBLIC "-//W3C//ENTITIES Special//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
 * PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent " in XHTML 1.0.
 * Old ISO subset: these are old (documented) character subsets used in legacy encodings before the unification within ISO 10646.
 * Description: the standard ISO 10646 and Unicode character name is displayed first for each character, with non-standard but legacy synonyms shown in italics between parentheses after an equal sign)
 * spaces: a blue background has been used in order to display each space's width.
 * ISO proposed: these characters have been standardized in ISO 10646 after the release of HTML 4.0.
 * ligature: this is a standard misnomer as this is a separate character in some languages.
 * black: here it seems to mean filled as opposed to hollow.
 * alefsym: 'alef symbol' is NOT the same as U+05D0 'Hebrew letter alef', although the same glyph could be used to depict both characters.
 * lArr: ISO 10646 does not say that 'leftwards double arrow' is the same as the 'is implied by' arrow but also does not have any other character for that function. So lArr</tt> can be used for 'is implied by' as ISOtech suggests.
 * rArr</tt>: ISO 10646 does not say that 'rightwards double arrow' is the 'implies' character but does not have another character with this function so rArr</tt> can be used for 'implies' as ISOtech suggests.
 * prod</tt>: 'n-ary product' is NOT the same character as U+03A0 'Greek capital letter Pi' though the same glyph might be used for both.
 * sum</tt>: 'n-ary summation' is NOT the same character as U+03A3 'Greek capital letter Sigma' though the same glyph might be used for both.
 * sim</tt>: 'tilde operator' is NOT the same character as U+007E 'tilde', although the same glyph might be used to represent both.
 * sup</tt>: note that nsup</tt>, U+2283 'not a superset of', is not covered by the Symbol font encoding and is not included. Should it be, for symmetry? It is in the ISOamsn subset.
 * perp</tt>: Unicode only defines U+22A5 as the "up tack". The Unicode symbol for "perpendicular" is U+27C2. The two symbols look similar, but are separate in Unicode. However, HTML uses U+22A5 as its "perpendicular" symbol. This is a discrepancy between HTML and Unicode. As well, the U+22A4 character (the "down tack" symbol) rendered in a browser such as FireFox 3.6 can match the font of either "up tack" or "perpendicular", but not both, depending on whether a fixed-width or a proportional font is used. When viewed in FireFox 3.6, the symbols rendered in the order U+22A5, U+22A4, U+27C2 in a proportional font: &#x22A5; &#x22A4; &#x27C2; and a fixed width one: &#x22A5; &#x22A4; &#x27C2;</tt>, shows that the "down tack" has a similar look to U+22A5 (HTML's "perpendicular") in the first case but matches U+27C2 in the second. This exemplifies the difficulties of the semiotics involved in interpreting glyphs, symbols and characters generally.
 * sdot</tt>: 'dot operator' is NOT the same character as U+00B7 'middle dot'.
 * lang</tt>: 'left-pointing angle bracket' is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation mark'.
 * rang</tt>: 'right-pointing angle bracket' is NOT the same character as U+003E 'greater than' or U+203A 'single right-pointing angle quotation mark'.

Entities representing special characters in XHTML
The XHTML DTDs explicitly declare 253 entities (including the 5 predefined entities of XML 1.0) whose expansion is a single character, which can therefore be informally referred to as "character entities". These (with the exception of the  entity) have the same names and represent the same characters as the 252 character entities in HTML. Also, by virtue of being XML, XHTML documents may reference the predefined  entity, which is not one of the 252 character entities in HTML. Additional entities of any size may be defined on a per-document basis. However, the usability of entity references in XHTML is affected by how the document is being processed:


 * If the document is read by a conforming HTML processor, then only the 252 HTML character entities can safely be used. The use of  or custom entity references may not be supported and may produce unpredictable results.
 * If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
 * If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.

Because of the special  case mentioned above, only ,  ,  , and   will work in all processing situations.