About Viewport Unit Calculator
Viewport units are percentages of the browser window: 1vw is a hundredth of its width and 1vh a hundredth of its height. This calculator turns a value in any of the four units into pixels for a window size you set, and shows the same value in the other units side by side.
Switch the direction to find what a pixel size from a mock-up is in vw, vh, vmin and vmax. Buttons fill in common phone, tablet, laptop and desktop sizes.
How it works
- One viewport unit is one percent of a side of the window: the width for vw, the height for vh, the shorter side for vmin and the longer side for vmax.
- To get pixels the value is multiplied by that one percent; to get viewport units a pixel size is divided by it.
- Results are rounded to four decimal places in text and two in the pixel column.
Questions
Why is 100vh taller than the screen on my phone?
Mobile browsers treat vh as the height with the address bar hidden. When the bar shows, part of a 100vh element is under it. The newer svh and dvh units use the smallest and the current height instead.
Why does 100vw make my page scroll sideways?
On desktop browsers with visible scrollbars, vw includes the width of the vertical scrollbar, so 100vw is slightly wider than the space the page has. Use 100% for full-width blocks instead.
Which viewport size should I enter?
The CSS size of the window, not the screen resolution. A phone with a 1170-pixel-wide screen usually has a viewport about 390px wide, because each CSS pixel covers several physical ones.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.