HTML Character Encoding: UTF-8 and Other Character Sets Explained

Learn about HTML character encoding and why UTF-8 is the recommended standard. This tutorial covers common character sets like ASCII, ANSI, ISO-8859-1, and UTF-8, explaining their differences and benefits for web development.



HTML Character Encoding: Understanding Character Sets

For web browsers to correctly display an HTML page, they need to know which character set (also known as character encoding) to use. This determines how the numbers in the HTML code are translated into the characters and symbols you see on the screen.

The `charset` Attribute

The character set is specified using the `charset` attribute within the `<meta>` tag inside the `<head>` section of your HTML document.

Example: Specifying UTF-8

<meta charset="UTF-8">

The HTML5 standard strongly recommends using UTF-8, as it supports a vast range of characters from virtually every language.

Common Character Sets

Here's a look at some common character sets:

ASCII

ASCII (American Standard Code for Information Interchange) was an early standard. It defined 128 characters, including basic English letters, numbers, and punctuation. It's limited in its character support.

ANSI (Windows-1252)

ANSI, also known as Windows-1252, extended ASCII by adding more characters to support Western European languages. It's largely compatible with ASCII for the first 127 characters.

ISO-8859-1

ISO-8859-1, the default for HTML 4, supports 256 characters, primarily focusing on Western European languages. While it supported more characters than ASCII, it's now largely superseded by UTF-8.

UTF-8

UTF-8 is the most widely used character set today. It's backward compatible with ASCII (the first 127 characters are identical) but also supports tens of thousands of characters from various languages and scripts. It's highly recommended for web development.

HTML Character Sets

The default character set in HTML5 is UTF-8. This table provides a complete reference to ASCII, ANSI, ISO 8859-1, and UTF-8 character codes.

Number ASCII ANSI ISO 8859-1 UTF-8 Description
32 space
33!!!!exclamation mark
34""""quotation mark
35####number sign
36$$$$dollar sign
37%%%%percent sign
38&&&&ampersand
39''''apostrophe
40((((left parenthesis
41))))right parenthesis
42****asterisk
43++++plus sign
44,,,,comma
45----hyphen-minus
46....full stop
47////solidus
480000digit zero
491111digit one
502222digit two
513333digit three
524444digit four
535555digit five
546666digit six
557777digit seven
568888digit eight
579999digit nine
58::::colon
59;;;;semicolon
60<<<<less-than sign
61====equals sign
62>>>>greater-than sign
63????question mark
64@@@@commercial at
65AAAALatin capital letter A
66BBBBLatin capital letter B
67CCCCLatin capital letter C
68DDDDLatin capital letter D
69EEEELatin capital letter E
70FFFFLatin capital letter F
71GGGGLatin capital letter G
72HHHHLatin capital letter H
73IIIILatin capital letter I
74JJJJLatin capital letter J
75KKKKLatin capital letter K
76LLLLLatin capital letter L
77MMMMLatin capital letter M
78NNNNLatin capital letter N
79OOOOLatin capital letter O
80PPPPLatin capital letter P
81QQQQLatin capital letter Q
82RRRRLatin capital letter R
83SSSSLatin capital letter S
84TTTTLatin capital letter T
85UUUULatin capital letter U
86VVVVLatin capital letter V
87WWWWLatin capital letter W
88XXXXLatin capital letter X
89YYYYLatin capital letter Y
90ZZZZLatin capital letter Z
91[[[[left square bracket
92\\\\backslash
93]]]]right square bracket
94^^^^circumflex accent
95____underscore
96````grave accent
97aaaaLatin small letter a
98bbbbLatin small letter b
99ccccLatin small letter c
100ddddLatin small letter d
101eeeeLatin small letter e
102ffffLatin small letter f
103ggggLatin small letter g
104hhhhLatin small letter h
105iiiiLatin small letter i
106jjjjLatin small letter j
107kkkkLatin small letter k
108llllLatin small letter l
109mmmmLatin small letter m
110nnnnLatin small letter n
111ooooLatin small letter o
112ppppLatin small letter p
113qqqqLatin small letter q
114rrrrLatin small letter r
115ssssLatin small letter s
116ttttLatin small letter t
117uuuuLatin small letter u
118vvvvLatin small letter v
119wwwwLatin small letter w
120xxxxLatin small letter x
121yyyyLatin small letter y
122zzzzLatin small letter z
123{{{{left curly bracket
124||||vertical bar
125}}}}right curly bracket
126~~~~tilde
127DELDELDELDELdelete
128Euro sign
129Undefined
130Single low-9 quotation mark
131ƒƒƒƒLatin small letter f with hook
132Double low-9 quotation mark
133Horizontal ellipsis
134Dagger
135Double dagger
136ˆˆˆˆModifier letter circumflex accent
137Per mille sign
138ŠŠŠŠLatin capital letter S with caron
139Single left-pointing angle quotation mark
140ŒŒŒŒLatin capital ligature OE
141Undefined
142ŽŽŽŽLatin capital letter Z with caron
143Undefined
144Undefined
145Left single quotation mark
146Right single quotation mark
147Left double quotation mark
148Right double quotation mark
149Bullet
150En dash
151Em dash
152˜˜˜˜Small tilde
153Trade mark sign
154ššššLatin small letter s with caron
155Single right-pointing angle quotation mark
156œœœœLatin small ligature oe
157Undefined
158žžžžLatin small letter z with caron
159ŸŸŸŸLatin capital letter Y with diaeresis
160    No-break space
161¡¡¡¡Inverted exclamation mark
162¢¢¢¢Cent sign
163££££Pound sign
164¤¤¤¤Currency sign
165¥¥¥¥Yen sign
166¦¦¦¦Broken bar
167§§§§Section sign
168¨¨¨¨Diaeresis
169©©©©Copyright sign
170ªªªªFeminine ordinal indicator
171««««Left-pointing double angle quotation mark
172¬¬¬¬Not sign
173­­­­Soft hyphen
174®®®®Registered sign
175¯¯¯¯Macron
176°°°°Degree sign
177±±±±Plus-minus sign
178²²²²Superscript two
179³³³³Superscript three
180´´´´Acute accent
181µµµµMicro sign
182Pilcrow sign
183····Middle dot
184¸¸¸¸Cedilla
185¹¹¹¹Superscript one
186ººººMasculine ordinal indicator
187»»»»Right-pointing double angle quotation mark
188¼¼¼¼Vulgar fraction one-quarter
189½½½½Vulgar fraction one-half
190¾¾¾¾Vulgar fraction three-quarters
191¿¿¿¿Inverted question mark
192ÀÀÀÀLatin capital letter A with grave
193ÁÁÁÁLatin capital letter A with acute
194ÂÂÂÂLatin capital letter A with circumflex
195ÃÃÃÃLatin capital letter A with tilde
196ÄÄÄÄLatin capital letter A with diaeresis
197ÅÅÅÅLatin capital letter A with ring above
198ÆÆÆÆLatin capital ligature AE
199ÇÇÇÇLatin capital letter C with cedilla
200ÈÈÈÈLatin capital letter E with grave
201ÉÉÉÉLatin capital letter E with acute
202ÊÊÊÊLatin capital letter E with circumflex
203ËËËËLatin capital letter E with diaeresis
204ÌÌÌÌLatin capital letter I with grave
205ÍÍÍÍLatin capital letter I with acute
206ÎÎÎÎLatin capital letter I with circumflex
207ÏÏÏÏLatin capital letter I with diaeresis
208ÐÐÐÐLatin capital letter Eth
209ÑÑÑÑLatin capital letter N with tilde
210ÒÒÒÒLatin capital letter O with grave
211ÓÓÓÓLatin capital letter O with acute
212ÔÔÔÔLatin capital letter O with circumflex
213ÕÕÕÕLatin capital letter O with tilde
214ÖÖÖÖLatin capital letter O with diaeresis
215××××Multiplication sign
216ØØØØLatin capital letter O with stroke
217ÙÙÙÙLatin capital letter U with grave
218ÚÚÚÚLatin capital letter U with acute
219ÛÛÛÛLatin capital letter U with circumflex
220ÜÜÜÜLatin capital letter U with diaeresis
221ÝÝÝÝLatin capital letter Y with acute
222ÞÞÞÞLatin capital letter Thorn
223ßßßßLatin small letter sharp s
224ààààLatin small letter a with grave
225ááááLatin small letter a with acute
226ââââLatin small letter a with circumflex
227ããããLatin small letter a with tilde
228ääääLatin small letter a with diaeresis
229ååååLatin small letter a with ring above
230ææææLatin small ligature ae
231ççççLatin small letter c with cedilla
232èèèèLatin small letter e with grave
233ééééLatin small letter e with acute
234êêêêLatin small letter e with circumflex
235ëëëëLatin small letter e with diaeresis
236ììììLatin small letter i with grave
237ííííLatin small letter i with acute
238îîîîLatin small letter i with circumflex
239ïïïïLatin small letter i with diaeresis
240ððððLatin small letter eth
241ññññLatin small letter n with tilde
242òòòòLatin small letter o with grave
243óóóóLatin small letter o with acute
244ôôôôLatin small letter o with circumflex
245õõõõLatin small letter o with tilde
246ööööLatin small letter o with diaeresis
247÷÷÷÷Division sign
248øøøøLatin small letter o with stroke
249ùùùùLatin small letter u with grave
250úúúúLatin small letter u with acute
251ûûûûLatin small letter u with circumflex
252üüüüLatin small letter u with diaeresis
253ýýýýLatin small letter y with acute
254þþþþLatin small letter thorn
255ÿÿÿÿLatin small letter y with diaeresis

Choosing the right character set ensures your web pages display correctly across different browsers and operating systems, making UTF-8 the ideal choice for virtually all web projects.