How to set character encoding for document in HTML5 ? Last Updated : 15 May, 2023 Comments Improve Suggest changes Like Article Like Report In this article, we will learn how to set character encoding for document in HTML5. Character encoding is a method of defining a mapping between bytes and text. To display an HTML document correctly, we must choose a proper character encoding. The different types of character encoding include: ASCII Character Set: It is the first ever character encoding standard. The major disadvantage with ASCII is that it contained only a limited range of characters (128 characters).ANSI Character Set: This standard was an extended version of standard ASCII character set. It supports 256 characters.ISO-8859-1 Character Set: It is the default character encoding in HTML 2.0. It is also an extension of ASCII standard with International characters. This used full bytes (8-bits) to show characters.UTF-8 Character Set: This standard covers almost all of the characters and symbols in the world. The limitations of ANSI and ISO-8859-1 were satisfied by the UTF-8 Character Set. The default character encoding for HTML5 is UTF-8. The HTML5 specification encourages developers to use the UTF-8 character set. A character can be 1-4 bytes long in the UTF-8 Encoding Standard. This is also the most preferred encoding for email and web pages. Character encoding can be specified in the meta tag in HTML.The meta tag is used for specifying metadata about the webpage and will not be displayed in the web pages.The meta tag helps search engines to understand what a web page is about.The meta tag should be placed with the head tag in HTML. Syntax: 1. For HTML4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 2. For HTML5 The default character encoding for HTML5 is UTF-8, but you can still specify this to be extra cautious. <meta charset="UTF-8"> Example: In this example, we will see the use of a meta character set HTML <!DOCTYPE html> <html> <head> <!-- NOTE: <meta charset="UTF-8"> is also applicable. --> <meta charset="utf-8"> <title>Page Title</title> </head> <body> <h2>Welcome To GFG</h2> <p> Default code has been loaded into the Editor. </p> </body> </html> Output: Comment More infoAdvertise with us Next Article How to set character encoding for document in HTML5 ? D deepthimgs Follow Improve Article Tags : Web Technologies HTML HTML5 HTML-Tags HTML-Questions +1 More Similar Reads How to fix âNo character encoding declared at document levelâ in HTML Document ? This article intends to solve the âNo character encoding declared at document levelâ issue in your HTML program. So, before getting to the solution, we need to understand what this issue means. And for that first, we need to know about character encoding in HTML. What is character encoding in HTML? 5 min read How to add emoji in HTML document ? Emojis are the characters from the Unicode character set that look like images or icons ????????????ââï¸. They can be sized, copied, or pasted like any other character in HTML. UTF-8 is the default charset that is used in HTML documents because it contains almost all of the characters and symbols. Em 3 min read How to Get File Character Encoding in Node.js ? Character encoding is essential when working with text files, as it determines how characters are represented in bytes. Different files may use different encodings, such as UTF-8, ASCII, or ISO-8859-1. Determining the character encoding of a file in Node.js can help ensure proper reading and process 2 min read How to indicate character set being used by a document in HTML ? For web browser to understand the set of characters used in the HTML document, various HTML encoding character set representations has been used like ASCII, ISO-8859-1, UTF-8 etc. The character set being used by an HTML document is indicated using the charset attribute of a <meta> tag inside t 2 min read How to Convert Special HTML Entities Back to Characters in PHP? Sometimes, when we work with HTML in PHP, you may encounter special characters that are represented using HTML entities. These entities start with an ampersand (&) and end with a semicolon (;). For example, < represents <, > represents >, and & represents &. To co 1 min read Like