W3docs

HTML Entities

HTML entities display reserved characters, invisible characters, and symbols not on a normal keyboard. Learn named, decimal, and hex references with examples.

There are a lot of symbols that are not present on a standard keyboard (mathematical, technical, currency symbols, etc.). Also, there are symbols that cannot be used because they can cause confusion. For example, we cannot use > because in HTML this symbol is parsed as a tag delimiter, and the browser won’t show it as text.

In HTML, entities display reserved characters, which can be confused with HTML code or invisible characters, like non-breaking spaces. They also represent characters that are difficult or impossible to type with a keyboard.

Every entity begins with an ampersand (&) and ends with a semicolon (;). The semicolon is required — without it, the browser may not recognize the entity at all.

Named, Decimal, and Hexadecimal References

There are three ways to write the same character. All three of the following produce an ampersand (&):

FormSyntaxExample for &
Named reference&name;&
Decimal numeric reference&#number;&
Hexadecimal numeric reference&#xhex;&

A named reference (like &) is easy to read and remember, but only a fixed set of names is defined. A numeric reference can represent any Unicode character by its code point — decimal (&) or hexadecimal (&). The decimal 38 and the hex 26 are just two ways of writing the same code point. Numeric references are useful when no named entity exists for the character you need.

Entity names are case-sensitive: & works, but & does not.

For example:

<p>5 &lt; 10 and 10 &gt; 5</p>
<title>HTML entities &amp; symbols</title>
<p>Snowman: &#9731; or &#x2603;</p>

When Entities Are Required

You don't need to escape every special character — most can be typed directly. Entities are required only when a character would otherwise be parsed as markup, or when you need an invisible character that a normal space won't give you:

  • &lt; — escapes < so the browser doesn't read it as the start of a tag.
  • &gt; — escapes > (recommended for symmetry, though it is only strictly required inside certain contexts).
  • &amp; — escapes & so it isn't read as the start of another entity.
  • &quot; — escapes a double quote inside an attribute value that is itself wrapped in double quotes.
  • &nbsp; — a non-breaking space, used to keep two words on the same line.

For instance, to keep a label and a year from being split across two lines, use a non-breaking space:

<p>Copyright&nbsp;2024</p>

The browser renders this as a normal space, but it will never wrap a line break between "Copyright" and "2024".

Note

With <meta charset="UTF-8"> declared, your page can store characters directly. That means most named entities for accented or non-English letters — &eacute; (é), &uuml; (ü), &ntilde; (ñ) — are unnecessary: you can just type é, ü, or ñ in the source. Reserve entities for the reserved markup characters (&lt;, &gt;, &amp;, &quot;) and for invisible or hard-to-type symbols. See HTML Character Sets for more on encoding.

Character Entities Commonly Used in HTML

ResultDescriptionEntity NameEntity Number
non-breaking space&nbsp;&#160;
<less than&lt;&#60;
>greater than&gt;&#62;
&ampersand&amp;&#38;
¢cent&cent;&#162;
£pound&pound;&#163;
¥yen&yen;&#165;
euro&euro;&#8364;
§section&sect;&#167;
©copyright&copy;&#169;
®registered trademark&reg;&#174;
trademark&trade;&#8482;

Math Symbols Supported by HTML

CharacterEntity NumberEntity NameDescription
&#8704;&forall;for all
&#8706;&part;partial differential
&#8707;&exist;there exists
&#8709;&empty;empty set
&#8711;&nabla;nabla (gradient)
&#8712;&isin;is an element of
&#8713;&notin;is not an element of
&#8715;&ni;contains as member
&#8719;&prod;n-ary product
&#8721;&sum;n-ary summation
&#8722;&minus;minus sign
&#8727;&lowast;asterisk operator
&#8730;&radic;square root
&#8733;&prop;proportional to
&#8734;&infin;infinity
&#8736;&ang;angle
&#8743;&and;logical and
&#8744;&or;logical or
&#8745;&cap;intersection
&#8746;&cup;union
&#8747;&int;integral
&#8756;&there4;therefore
&#8764;&sim;similar to
&#8773;&cong;congruent to
&#8776;&asymp;almost equal to
&#8800;&ne;not equal to
&#8801;&equiv;identical to
&#8804;&le;less than or equal to
&#8805;&ge;greater than or equal to
&#8834;&sub;subset of
&#8835;&sup;superset of
&#8836;&nsub;not a subset of
&#8838;&sube;subset of or equal to
&#8839;&supe;superset of or equal to
&#8853;&oplus;circled plus
&#8855;&otimes;circled times
&#8869;&perp;perpendicular to
&#8901;&sdot;dot operator

Greek Letters Supported by HTML

CharacterEntity NumberEntity NameDescription
Α&#913;&Alpha;Alpha
Β&#914;&Beta;Beta
Γ&#915;&Gamma;Gamma
Δ&#916;&Delta;Delta
Ε&#917;&Epsilon;Epsilon
Ζ&#918;&Zeta;Zeta
Η&#919;&Eta;Eta
Θ&#920;&Theta;Theta
Ι&#921;&Iota;Iota
Κ&#922;&Kappa;Kappa
Λ&#923;&Lambda;Lambda
Μ&#924;&Mu;Mu
Ν&#925;&Nu;Nu
Ξ&#926;&Xi;Xi
Ο&#927;&Omicron;Omicron
Π&#928;&Pi;Pi
Ρ&#929;&Rho;Rho
Σ&#931;&Sigma;Sigma
Τ&#932;&Tau;Tau
Υ&#933;&Upsilon;Upsilon
Φ&#934;&Phi;Phi
Χ&#935;&Chi;Chi
Ψ&#936;&Psi;Psi
Ω&#937;&Omega;Omega
α&#945;&alpha;alpha
β&#946;&beta;beta
γ&#947;&gamma;gamma
δ&#948;&delta;delta
ε&#949;&epsilon;epsilon
ζ&#950;&zeta;zeta
η&#951;&eta;eta
θ&#952;&theta;theta
ι&#953;&iota;iota
κ&#954;&kappa;kappa
λ&#955;&lambda;lambda
μ&#956;&mu;mu
ν&#957;&nu;nu
ξ&#958;&xi;xi
ο&#959;&omicron;omicron
π&#960;&pi;pi
ρ&#961;&rho;rho
ς&#962;&sigmaf;sigmaf
σ&#963;&sigma;sigma
τ&#964;&tau;tau
υ&#965;&upsilon;upsilon
φ&#966;&phi;phi
χ&#967;&chi;chi
ψ&#968;&psi;psi
ω&#969;&omega;omega
ϑ&#977;&thetasym;theta symbol
Υ&#978;&upsih;upsilon symbol
ϖ&#982;&piv;pi symbol

Other Entities Supported by HTML

CharacterEntity NumberEntity NameDescription
Œ&#338;&OElig;capital ligature OE
œ&#339;&oelig;small ligature oe
Š&#352;&Scaron;capital S with caron
š&#353;&scaron;small S with caron
Ÿ&#376;&Yuml;capital Y with diaeres
ƒ&#402;&fnof;f with hook
ˆ&#710;&circ;modifier letter circumflex accent
˜&#732;&tilde;small tilde
&#8194;&ensp;en space
&#8195;&emsp;em space
&#8201;&thinsp;thin space
&#8204;&zwnj;zero width non-joiner
&#8205;&zwj;zero width joiner
&#8206;&lrm;left-to-right mark
&#8207;&rlm;right-to-left mark
&#8211;&ndash;en dash
&#8212;&mdash;em dash
&#8216;&lsquo;left single quotation mark
&#8217;&rsquo;right single quotation mark
&#8218;&sbquo;single low-9 quotation mark
&#8220;&ldquo;left double quotation mark
&#8221;&rdquo;right double quotation mark
&#8222;&bdquo;double low-9 quotation mark
&#8224;&dagger;dagger
&#8225;&Dagger;double dagger
&#8226;&bull;bullet
&#8230;&hellip;horizontal ellipsis
&#8240;&permil;per mille
&#8242;&prime;minutes
&#8243;&Prime;seconds
&#8249;&lsaquo;single left angle quotation
&#8250;&rsaquo;single right angle quotation
&#8254;&oline;overline
&#8592;&larr;left arrow
&#8593;&uarr;up arrow
&#8594;&rarr;right arrow
&#8595;&darr;down arrow
&#8596;&harr;left right arrow
&#8629;&crarr;carriage return arrow
&#8968;&lceil;left ceiling
&#8969;&rceil;right ceiling
&#8970;&lfloor;left floor
&#8971;&rfloor;right floor
&#9674;&loz;lozenge
&#9824;&spades;spade
&#9827;&clubs;club
&#9829;&hearts;heart
&#9830;&diams;diamond

Non-breaking Space

The non-breaking space (&nbsp;) is one of the most common character entities used in HTML. It is a space that doesn’t break into a new line. This means that two words that are divided by a non-breaking space will stay together. Besides, the non-breaking space stops browsers from collapsing multiple spaces into a single one.

For the full list of code points and how characters map to numbers, see the HTML Unicode Reference.

Diacritical Marks

When we say a diacritical mark, we mean a “glyph” that is added to a letter. Some of these marks, like grave (̀) and acute (́) are called accents. Diacritical marks may occur above and below a letter, between two letters or inside a letter.

Here is a list containing some diacritical marks:

MarkCharacterConstructResult
̀aa&#768;
́aa&#769;
̂aa&#770;
̃aa&#771;
̀OO&#768;
́OO&#769;
̂OO&#770;
̃OO&#771;

Practice

Practice
Which of the following are valid HTML entities? (Select all that apply.)
Which of the following are valid HTML entities? (Select all that apply.)
Was this page helpful?