Resolution vs Viewport vs DPI
Screen resolution (screen.width / screen.height) is the total physical pixel grid of your display, fixed by the hardware and your current display mode. Available screen space (screen.availWidth / screen.availHeight) is slightly smaller on desktop OSes that reserve space for a taskbar or dock. Viewport size (window.innerWidth / window.innerHeight) is how much of the screen your actual browser window/tab currently occupies - it shrinks and grows as you resize the browser window, completely independent of the screen's fixed resolution.
DPI (dots per inch) describes pixel density - how tightly packed the physical pixels are. Unlike resolution and viewport size, there's no direct browser API that returns a display's true DPI, because that requires knowing the panel's exact physical size in inches, which browsers deliberately don't expose.
Device Pixel Ratio & the 96 DPI Reference
window.devicePixelRatio is the ratio between physical display pixels and CSS pixels. On a standard-density display it's 1 (one physical pixel per CSS pixel); on a high-density "Retina"-style display it's commonly 2 or 3 (a 2x2 or 3x3 block of physical pixels renders each CSS pixel), making text and images look noticeably sharper.
CSS defines its reference resolution as exactly 96 pixels per inch at a device pixel ratio of 1 - this is a specification convention, not a measurement of any real screen. That's why this tool's "approximate DPI" is calculated as 96 × devicePixelRatio: it's the browser's own internal assumption about pixel density, which tends to roughly track real-world density because operating systems adjust the reported device pixel ratio to compensate for their own display scaling settings - but it is still an approximation, not a measured physical value.
Common Use Cases
How to Read the Stats
| Stat | Source Property | Meaning |
|---|---|---|
| Screen Resolution | screen.width/height | Total physical pixel grid of your display |
| Available Screen Space | screen.availWidth/availHeight | Usable space after OS taskbars/docks are excluded |
| Viewport Size | window.innerWidth/innerHeight | Current browser window's content area, updates on resize |
| Device Pixel Ratio | window.devicePixelRatio | Physical pixels per CSS pixel |
| Orientation | screen.orientation.type/angle | Landscape/portrait and rotation angle |
Frequently Asked Questions
screen.width/height is the full physical panel resolution. screen.availWidth/availHeight subtracts space reserved for OS UI like a taskbar or dock, so it's usually slightly smaller and can shift if you resize or move that taskbar.
It changes if you drag a window from one monitor to a different one with a different pixel density, or if the OS display-scaling setting changes. This tool watches for that with a matchMedia resolution query rather than only listening for window resize, so the DPI figure stays live in that case too.
screen.colorDepth and screen.pixelDepth are near-identical in modern browsers and normally both report 24 bits (or higher on some wide-gamut/HDR setups). The two separate properties exist for historical specification reasons rather than describing genuinely different things today.
screen.orientation isn't implemented in every older browser, notably older Safari versions. When it's missing, matching an "(orientation: portrait)" media query gives a decent portrait/landscape approximation, though without the exact rotation angle the real API provides.
No. screen.width/height reflect the display hardware and current OS display mode, completely independent of the browser window. Only window.innerWidth/innerHeight (the viewport) change when you resize the browser.