W3cubDocs

/Web APIs

Document: characterSet property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

The Document.characterSet read-only property returns the character encoding of the document that it's currently rendered with.

Note: A "character set" and a "character encoding" are related, but different. Despite the name of this property, it returns the encoding.

Value

A string.

Examples

console.log(document.characterSet);
// document's character encoding, such as "ISO-8859-1" or "UTF-8"

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
characterSet 1
1charset alias was made read-only in Chrome 45.
1
121212 1441.5 ≤12.1
15charset alias was made read-only in Opera 45.
15
333 18
18charset alias was made read-only in Chrome Android 45.
18
4444 ≤12.1
14charset alias was made read-only in Opera 45.
14
111 1.0
1.0charset alias was made read-only in Samsung Internet 5.0.
1.0
1
1charset alias was made read-only in WebView 45.
1
111

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/characterSet