VH Units Explained: Sizing by Viewport Height
Viewport units size things relative to the window instead of fixed pixels. This guide explains vh and how to turn it into pixels.
What is the VH to PX Converter?
One vh is one percent of the height of the viewport, the visible area of the browser window. This tool multiplies a vh value by the viewport height to give the equivalent pixels. Because the answer depends on the actual window height, the same vh value gives different pixels on a phone and on a desktop monitor. It uses the height you enter, so measure your viewport if you need an exact figure.
How to use it
- Enter the vh value.
- Enter the viewport height in pixels.
- Press the button to see the pixel value.
Worked example
50 vh on an 800 pixel tall viewport converts to 400 px.
How do I convert vh to pixels?
Multiply the vh value by the viewport height and divide by 100. For example, 50 vh on an 800 pixel viewport is 400 pixels.
Frequently asked questions
What is 100 vh?
100 vh is the full height of the viewport, so on an 800 pixel tall window it equals 800 pixels.
Why does the same vh value look different on devices?
Because vh is relative to the viewport. A taller window makes each vh unit worth more pixels, so the result changes with the screen.