Detect Screen Resolution

Get the hardware stats. Unlike window size, this script tells you the maximum resolution setting of the visitor's physical display monitor.

Your Monitor Resolution:
0 x 0
Color Depth: ...

Copy the Script

<script>
var width = screen.width;
var height = screen.height;
var depth = screen.colorDepth;

document.write("Resolution: " + width + " x " + height);
document.write("<br>Color Depth: " + depth + "-bit");
</script>

Frequently Asked Questions

No. `screen.width` and `screen.height` return the dimensions of the hardware monitor, regardless of how small the browser window is.

On high-density screens (like mobile phones), this usually returns the CSS pixel width (viewport), not the physical hardware pixels, to ensure content remains readable.

Yes. You can use `if (screen.width <= 768) window.location='mobile.html'` to send small screens to a different page.