@charset CSS At-Rule


The @charset CSS at-rule is used to set the encoding of an external CSS stylesheet. This at-rule is useful when using non-ASCII characters in some CSS properties, like content.
For an external style sheet, the browser sequentially looks at the following items to determine the encoding of the style sheet:

1. The encoding that the server gives;
2. @charset rule;
3. the charset attribute of the element (this attribute is deprecated, do not use it).

The above list has a clearly defined hierarchy - the higher the item is, the higher its priority. If none of the items are found, the UTF-8 encoding will be assumed.


@charset "charset";


  • charsetIs a <string> denoting the character encoding to be used. It must be the name of a web-safe character encoding defined in the IANA-registry, and must be double-quoted, following exactly one space character, and immediately terminated with a semicolon.


@charset "UTF-8";
@charset "iso-8859-1";

Browser Support

Explorer Edge Chrome Firefox Opera Safari
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung

Last updated by CSSPortal on: 1st December 2019