Adding Symbols and Special Characters to HTML using HTML Entities

Learn how to insert special characters and symbols into your HTML documents using HTML entities. This tutorial explains how to use both named entities and numeric character references (decimal and hexadecimal) for consistent rendering across different browsers and systems.



Adding Symbols and Special Characters to HTML

Using HTML Entities

HTML entities provide a way to insert characters that aren't readily available on your keyboard, such as mathematical symbols, Greek letters, currency symbols, and arrows. These entities use either a name or a numerical code (decimal or hexadecimal) to represent the character. This ensures consistent rendering across different systems and browsers.

Examples of HTML Entities

Here are examples using both entity names and numerical codes:

Euro Sign (€):

Euro Sign

<p>Euro Sign: &euro;</p>
<p>Euro Sign (Decimal): €</p>
<p>Euro Sign (Hex): €</p>

All three examples will display the euro symbol (€).

Mathematical Symbols

Character Decimal Code Entity Name Description
8704 &forall; For all
8706 &part; Partial differential
8707 &exist; There exists
8709 &empty; Empty set
8711 &nabla; Nabla
8712 &isin; Element of
8713 &notin; Not an element of
8715 &ni; Contains as a member
8719 &prod; N-ary product
8721 &sum; N-ary summation

Greek Letters

Character Decimal Code Entity Name Description
Α 913 &Alpha; Greek Alpha
Β 914 &Beta; Greek Beta
Γ 915 &Gamma; Greek Gamma
Δ 916 &Delta; Greek Delta
Ε 917 &Epsilon; Greek Epsilon
Ζ 918 &Zeta; Greek Zeta

Other Symbols

Character Decimal Code Entity Name Description
© 169 &copy; Copyright
® 174 &reg; Registered Trademark
8482 &trade; Trademark
8592 &larr; Left Arrow
8593 &uarr; Up Arrow
8594 &rarr; Right Arrow
8595 &darr; Down Arrow
9824 &spades; Spade Suit
9827 &clubs; Club Suit
9829 &hearts; Heart Suit
9830 &diams; Diamond Suit