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:

The 'screen.colorDepth' property

Tip:

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

butpixelDepth and colorDepth return the same value.

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

Example

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
Supports Supports Supports Supports Supports Supports

Related pages

The 'screen.availHeight' property

screen.availWidth Property

screen.height Property

screen.width Property