Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML charset Attribute


Definition and Usage

When used by the <meta> element, the charset attribute specifies the character encoding for the HTML document.

When used by the <script> element, the charset attribute specifies the character encoding used in an external script file.


Applies to

The charset attribute can be used on the following elements:

Elements Attribute
<meta> charset
<script> charset

Examples

Meta Example

Specify the character encoding for the HTML document:

<head>
<meta charset="UTF-8">
</head>
Try it Yourself »

Script Example

An external JavaScript with an UTF-8 character set:

<script src="myscripts.js" charset="UTF-8"></script>
Try it Yourself »

Browser Support

The charset attribute has the following browser support for each element:

Element
meta Yes Yes Yes Yes Yes
script Yes Yes Yes Yes Yes