Screen pixelDepth Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Screen pixelDepth Property

❮ Screen Object

Example

Get the color resolution of your screen:

var x = "Color Resolution: " + screen.pixelDepth;
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The pixelDepth property returns the color resolution (in bits per pixel) of the visitor's screen.

Tip: The pixelDepth property is not supported in Internet Explorer 9 and earlier versions. However, the colorDepth property represents the same thing as the pixelDepth property. Since all major browsers support colorDepth, use that property instead.


Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
pixelDepth Yes 10.0 Yes Yes Yes

Syntax

screen.pixelDepth


Technical Details

Return Value: A Number, representing the color resolution, in bits per pixel.

Possible values:
  • 1 bit per pixel
  • 4 bits per pixel
  • 8 bits per pixel
  • 15 bits per pixel
  • 16 bits per pixel
  • 24 bits per pixel
  • 32 bits per pixel
  • 48 bits per pixel

More Examples

Example

All screen properties in one example:

var txt = "";
txt += "<p>Total width/height: " + screen.width + "*" + screen.height + "</p>";
txt += "<p>Available width/height: " + screen.availWidth + "*" + screen.availHeight + "</p>";
txt += "<p>Color depth: " + screen.colorDepth + "</p>";
txt += "<p>Color resolution: " + screen.pixelDepth + "</p>";
Try it Yourself »

❮ Screen Object