HTML Introduction | HTML Text Elements | Character Set

For a web browser to display an HTML document correctly, it must know which character set was used when the document was saved. Therefore, information about the character set used to save the HTML document is specified in a <meta> tag inside the <head> tag.

UTF-8 in HTML4

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

UTF-8 in HTML5

<meta charset="UTF-8">

Both examples tell the web browser that the HTML document was saved using the UTF-8 character set.

Types of character sets

Common character sets currently in use are as follows.

  1. ASCII: The first character set, consisting of 127 English letters and numbers that can be used on the Internet.
  2. ANSI: A character set created by Windows that supports a total of 256 character codes.
  3. ISO-8859-1: The default character set of HTML4, which supports 256 character codes.
  4. UTF-8: The default character set of HTML5, supporting Unicode characters that can represent almost every character in the world.