Browser viewport data

A test page showing useful browser viewport information

This page outputs the values of five things as reported by your browser.

  • The screen resolution
  • the browser viewport,
  • the layout viewport,
  • the pixel density,
  • the viewport scale.

On mobile devices, the viewport scale section will also indicate if the desktop site has been requested and the page has been scaled to fit the viewport.

Visual viewport size

window.innerWidth and window.innerHeight.

The viewport size, as reported by your browser is:


Calculated from window.orientation. 0 is the device default orientation. 90 is laying on it's left side. -90 is laying on it's right side. 180 is upside down.

The page orientation, as reported by your browser is:

Viewport scale

Calculated from window.innerWidth and screen.width (or height in some cases)

The initial (calculated) viewport scale:

Layout viewport size


The page size, as reported by the the browser:

Device pixel density


The device pixel ratio, as reported by your browser is:

Screen resolution

screen.width and screen.height.

The screen resolution, as reported by your browser is:

Originally created in May 2013. Checked and updated in April 2023. Thanks to Edward Cant for providing some code and pointers for the viewport scale calculation method.