HTML Special Characters
By Tony 2023.5.3 • Last updated 2024.1.27
Let's say you're starting a code tutorial website like this one, and you want to write this line of code within your page: <h1>Hello World!</h1> but whatever you try, you just can't type < > symbols normally. Does that mean you can't do that in HTML? This is what HTML special characters is about. Here is an example:
<h2>Symbols Entities</h2>
<ul>
ww<li>Less than: <</li>
ww<li>Greater than: ></li>
ww<li>Numbered entity: Y</li>
ww<li>Named entity: ⌖</li>
ww<li>Double quote: "</li>
ww<li>Single quote: '</li>
ww<li>Semicolon : ;</li>
ww<li>Copyright : ©</li>
ww<li>A random symbol : ഔ</li>
ww<li>The first numbered entity: !</li>
ww<li>The last: 힣</li>
</ul>
HTML special characters are typed using "entities" – codes that start with an ampersand (&) and end with a semicolon (;). Numbered entities use a symbol list with over 50,000 symbols. Put a hashtag (#) and the symbol's number code after the ampersand (&) when using numbered entities.
ϧ is ϧ
HTML5 also has named entities using letters after & instead of a hashtag and a number that represent letters, punctuation, math, and currency symbols. However, named entities are more limited than numbered entities.
! is !
Here's the output of the example above:
Symbols Entities
- Less than: <
- Greater than: >
- Numbered entity: Y
- Named entity: ⌖
- Double quote: "
- Single quote: '
- Semicolon : ;
- Copyright : ©
- A random symbol : ഔ
- The first numbered entity: !
- The last: 힣
We type special characters in HTML by using codes called numbered intities and named entities. Numbered entities follow the format
&#number-that-represents-the-symbol; and named entities follow the format &letters-that-represent-the-symbol;. HTML special characters are very useful, so remember the important symbols' codes!
Symbol | Numbered entities | Named entities |
---|---|---|
  | | |
< | < | < |
> | > | > |
& | & | & |
# | # | # |
" | " | " |
' | ' | ' |
¢ | ¢ | ¢ |
© | © | © |
Note: the symbol will vary depends on the font style.