screen.colorDepth is a read-only number for the screen’s color depth (MDN). Read it as window.screen.colorDepth. Many engines report 24 for CSSOM compatibility.
Read the notes below before you rely on this property. Prefer feature detection when support is limited.
Syntax
Use screen.colorDepth. Start with this line.
JavaScript
screen.colorDepth
Call
What it does
screen.colorDepth
Primary signature.
Built into the browser. Read screen.colorDepth on window.screen — no import required.
Library declarations
JavaScript
screen.colorDepth
Parameters
This member has no parameters beyond those shown in the signature.
Use for diagnostics — not as a hard hardware fingerprint.
Prefer CSS media for most visual adaptation; keep this as a simple check.
Compatibility
Browser Support
screen.colorDepth is Baseline Widely available (since July 2015). Supported across major browsers. Remember: many engines report 24 for CSSOM compatibility rather than exact hardware depth.
✓ Baseline Widely available
Screen.colorDepth
Read-only number — screen color depth in bits (often 24).
YesBaseline
Google ChromeYes (Baseline)
Yes
Microsoft EdgeYes (Baseline)
Yes
Apple SafariYes (Baseline)
Yes
OperaYes (Chromium-based)
Yes
Mozilla FirefoxYes (Baseline)
Yes
Internet ExplorerSupported in IE era Screen API
Yes
colorDepthWidely
Bottom line: Read window.screen.colorDepth, treat 24 as common, compare with pixelDepth if needed. See the MDN colorDepth reference.
Frequently Asked Questions
A read-only number representing the color depth of the screen (typically bits per pixel). Access it as window.screen.colorDepth (MDN).
No. MDN marks Screen.colorDepth as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
MDN: per the CSSOM, some implementations return 24 for compatibility reasons. Check the compatibility table for engines that differ.
Both describe screen color capability. On most modern browsers they report the same number. Treat them as related diagnostics, not a guarantee of exact hardware bit depth.
No. It is read-only. You read the number; you do not assign to it.
MDN shows that pattern for a low-color fallback. Today almost all user screens report at least 24, so the low-color branch is rare — but it remains a clear teaching example.