b2KIT

Viewport Unit Calculator

Calculate and convert vh, vw, vmin, and vmax CSS viewport units based on screen dimensions.

Tested tool guide Tested browser tools Checked August 16, 2026

What Viewport Unit Calculator does, with a checked example

Takes a viewport width and height in pixels and converts between px and the four CSS viewport units: vh (1% of height), vw (1% of width), vmin (1% of the smaller axis), and vmax (1% of the larger axis). Every result is plain arithmetic, so a 1920x1080 viewport yields 1vw = 19.2px and 1vh = 10.8px. The common mistake is the input: the browser viewport is the window's inner size in CSS pixels, not the monitor resolution. Browser chrome, the OS taskbar, display scaling, and mobile URL bars all change the number the browser actually measures.

Worked example

A concrete input and expected output from the current implementation.

Input

Viewport 1920 x 1080
Convert 50vw, 50vh, 10vmin, 10vmax to px

Expected output

50vw = 960px, 50vh = 540px, 10vmin = 108px, 10vmax = 192px

Each unit is 1% of one axis: vw and vmax follow the 1920px width (19.2px per unit), while vh and vmin follow the 1080px height (10.8px per unit). So 50 x 19.2px = 960px, 50 x 10.8px = 540px, 10 x 10.8px = 108px, and 10 x 19.2px = 192px.

How the result is produced

1

One percent per axis

Each unit is exactly 1% of a viewport dimension: vh is height divided by 100, vw is width divided by 100, vmin is the smaller per-unit value and vmax the larger. On a 1920x1080 viewport, 1vh and 1vmin are both 10.8px while 1vw and 1vmax are both 19.2px. Multiplying a unit value by any number gives the pixel equivalent, and dividing a pixel target by the unit value gives the unit amount.

2

The input is the initial containing block

The width and height entered are treated as the initial containing block the units measure against. Enter the window's inner size in CSS pixels, not the monitor's: zoom and display scaling shrink the CSS viewport (a 1920px monitor at 125% scaling presents a 1536px-wide viewport), and rotating a device swaps which axis vw and vh follow while vmin and vmax stay the same.

Good uses

  • Turning a pixel-measured design mock into fluid CSS: a 960px-wide hero on a 1920x1080 target becomes 50vw, and the tool confirms the conversion in both directions.
  • Checking that full-viewport elements fit your layout budget: compute what 100vh is in px on the smallest laptop you support before placing a fixed-height header next to it.
  • Verifying vmin sizing on portrait phones: at 10vmin on a 390x844 screen the value is 39px, identical to 10vw, so the element can never overflow the narrower axis.

Limits and checks

  • Results only match the browser if the entered dimensions do. The real viewport excludes tabs, bookmarks bars, and scrollbars, and CSS pixels shrink under zoom or OS scaling, so a 1920px-wide monitor at 125% scaling lays out a 1536px-wide viewport.
  • On mobile, the viewport height changes as the URL bar collapses, so a vh computed for one moment is wrong later; 100vh can exceed the visible area. The dynamic, small, and large viewport units (dvh, svh, lvh) exist for exactly this reason.
  • vw and vh swap axes when the screen rotates; vmin and vmax do not change at all. A landscape calculation does not carry to portrait unless you re-enter the swapped dimensions.

Common questions

Why is 100vh taller than the visible area on my phone?

Mobile browsers size the viewport to the largest height the browser chrome allows, and 100vh measures that full size. While the URL bar is visible, the on-screen area is shorter. For elements that must fit what is visible, use the dynamic or small viewport units (dvh, svh) instead of vh.

Does the calculator handle browser zoom or device pixel ratio automatically?

No. It does arithmetic on the two numbers you enter and knows nothing about your browser or display. CSS pixels are logical units: at 150% display scaling, a 1440px-wide monitor presents a 960px-wide CSS viewport, and you must enter 960 for results that match what the browser actually lays out.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools