Window screen.pixelDepth property

Definition and usage

pixelDepth The property returns the color depth of the screen.

pixelDepth The property returns the color depth in bits per pixel.

pixelDepth The property is read-only.

See also:

screen.colorDepth property

Tip:

Internet Explorer 9 and earlier versions do not support pixelDepth property.

However,pixelDepth and colorDepth Return the same value.

Since all browsers support colorDepth, please use this property instead.

Instance

Example 1

Get the screen color resolution:

let depth = screen.pixelDepth;

Try it yourself

Example 2

All screen properties:

let text = "Total width/height: " + screen.width + "*" + screen.height + "<br>"
"Available width/height: " + screen.availWidth + "*" + screen.availHeight + "<br>"
"Color depth: " + screen.colorDepth + "<br>"
"Color resolution: " + screen.pixelDepth;

Try it yourself

Syntax

screen.pixelDepth

Return value

Type Description
Number

Color resolution per pixel bit:

1, 4, 8, 15, 16, 24, 32, or 48.

Browser support

All browsers support screen.pixelDepth:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Supported Supported Supported Supported Supported Supported

Related pages

screen.availHeight property

screen.availWidth property

screen.height property

screen.width property