ConverterHubsConverterHubs

PX to VW/VH Converter — Fluid Viewport-Relative Units

Viewport units let you size elements as a percentage of the actual browser window — not the document, not a parent element, but the live screen dimensions. This makes them ideal for hero sections, full-screen modals, and fluid typography that scales seamlessly with any screen size.

Convert pixel dimensions to viewport-relative CSS units (vw, vh). Build fluid layouts that scale precisely with the browser window. Understand the vw/vh formula and edge cases like the iOS 100vh mobile browser bug.

1vw = 1% of viewport width; 1vh = 1% of viewport height.

Designing with Viewport Units

1vw equals 1% of the viewport width. 1vh equals 1% of the viewport height. The conversion depends on the current screen dimensions — so unlike px, rem, or pt, vw/vh values are dynamic. This tool calculates the value for your specified viewport size.

  1. 1Enter the target pixel size you want to express as a viewport unit.
  2. 2Enter the total viewport width or height you are designing for (e.g. 1440px or 768px).
  3. 3Copy the resulting vw or vh value into your CSS for a perfectly fluid layout.

Viewport Unit Conversion Formula

VW and VH are calculated as a percentage of the current viewport dimensions. Because these dimensions change with every user's screen and window, the pixel-to-vw/vh conversion is always relative to your target viewport size.

VW = (Target PX ÷ Viewport Width) × 100 VH = (Target PX ÷ Viewport Height) × 100 Example: 720px ÷ 1440px × 100 = 50vw

Viewport Unit Reference Points

Common viewport unit values and their design meanings across standard screen widths:

Viewport Unit ValueMeaning & Use Case
100vwFull viewport width (beware scrollbar overflow bug)
100vhFull viewport height (beware iOS Safari address bar bug)
100dvhDynamic viewport height — fixes iOS Safari mobile issue
50vwHalf the screen width — ideal for two-column layouts
50vhHalf the screen height — ideal for split-screen hero
1vw at 1440px14.4px
1vw at 375px (mobile)3.75px
clamp(1rem, 2.5vw, 2rem)Fluid typography between 16px and 32px
min(90vw, 1200px)Container capped at 1200px, fluid below
height: 100svhSmall viewport height — excludes browser chrome

Viewport Unit FAQs

iOS Safari's browser chrome (address bar and toolbar) overlaps the viewport, making 100vh taller than the visible area. Use 100dvh (dynamic viewport height) instead, which is supported in all modern browsers since 2022 and recalculates as the browser chrome appears and disappears.

Use % for sizing relative to a parent container. Use vw/vh for sizing relative to the entire browser window. For example, a sidebar that is 25% of its parent div uses %, while a hero section that always fills the screen uses 100vw × 100vh.

Yes, and it creates beautifully fluid typography. However, never use vw alone for fonts — combine it with clamp() to set minimum and maximum sizes. Example: font-size: clamp(1rem, 2.5vw, 2rem). This keeps text readable on both mobile and ultra-wide screens.

Viewport units unlock fully fluid, screen-aware layouts — but they require understanding edge cases like the iOS 100vh bug and scrollbar-induced overflow. Use this converter to quickly calculate vw/vh values for your next responsive design.

Related Tools