Widely availableSupported across all major browsers. Safe to use in production.

Overview

The @charset CSS at-rule specifies the character encoding of an external style sheet.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
2
12
1.5
4
18
4
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
  • Firefox 1 supported an invalid syntax where the character encoding is not between single or double quotes.

Syntax

CSS
@charset "UTF-8";

body {
  font-family: sans-serif;
}

Live demo

@charset "UTF-8"

CSS @charset "UTF-8" demo.

PreviewFullscreen

Japanesetextdisplay

CSS Japanesetextdisplay demo.

PreviewFullscreen

specialcharacter. Display

CSS specialcharacter. Display demo.

PreviewFullscreen

Use cases

  • Using @charset

    The @charset CSS at-rule specifies the character encoding of an external style sheet.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.

Powered by web-features