Viewport Calculator

CSS viewport size from a screen resolution and pixel ratio, and what vw, vh, vmin or vmax come to in pixels.

How it works

Enter the screen resolution and pixel ratio. The tool gives the CSS viewport size that media queries see, and what a vw, vh, vmin or vmax value comes to in pixels.

The formula

CSS pixels = device pixels / pixel ratio

Worked example

1170 x 2532 at a ratio of 3 is 390 x 844 CSS pixels. 50vw is 195 px.

Good to know

Common questions

What is a pixel ratio?
Device pixels per CSS pixel.
What is vmin?
The smaller of vw and vh.
Does it detect my device?
No. You type the values.

More in Utilities.