Unit Converter
PX to VH Converter
Convert a CSS pixel length to viewport height units (vh) using a viewport height you specify.
PX to VH Converter examples
| Input | Expected result |
|---|---|
| 90 px, viewport 900 px | 10 vh |
| 80 px, viewport 800 px | 10 vh |
| 16 px, viewport 800 px | 2 vh |
| 844 px, viewport 844 px | 100 vh |
Supported units & limits
Accepts decimal and scientific-notation lengths, zero and signed values, with a strictly positive viewport height. Enter numbers without units. The 900 px default is an editable example and is not measured from your browser. Plain vh uses the large viewport size in modern CSS; this calculator does not model changing browser toolbars, virtual keyboards, safe areas, or svh/dvh units. Results outside the supported number range are rejected.
Common mistakes
A phone’s hardware pixel height is not its CSS viewport height. The visible mobile page area can also differ from the large viewport height used by vh, so 100 vh may extend behind browser controls. Percent height often uses a containing block instead of the viewport. A single pixel-to-vh value only matches at the chosen reference height.
Privacy
Conversions run in your browser. This site does not upload or store the values you enter. We use Google Analytics, loaded through Google Tag Manager, to count page visits and see which tools are used; Google may set cookies for this. The hosting server may keep standard access logs when you load a page.
Conversion guide
Check vertical sizing on mobile browsers
Start from the CSS viewport height that your design targets, enter the desired pixel dimension and read its vh proportion. Test the declaration with browser controls expanded and retracted. Keep safe-area padding and keyboard behavior separate, and choose the appropriate viewport unit for the intended behavior. Mobile browsers change the visible height as the toolbar moves, so test values from the PX to VH Converter on a real device.
PX to VH Converter FAQ
Does 100 vh always fill the visible mobile screen?
Not necessarily. Plain vh uses the large viewport basis. Browser controls can make the current visible area smaller. Depending on the design, small or dynamic viewport units may be more suitable.
Can I use the same number for dvh?
The percentage arithmetic is the same if you supply the matching dynamic viewport height. This page labels the result as vh and does not detect or track dynamic height.
Is vh based on my parent element height?
No. vh is a viewport unit. Percentage heights can use a containing block and have different layout rules.