Design tools

Viewport Unit Calculator

Viewport Unit Calculator (px ⇄ vw, vh)

Convert px to vw, vh, vmin and vmax for any screen size, and back.

About this tool

About Viewport Unit Calculator

Viewport units size things relative to the browser window: 1vw is one hundredth of its width and 1vh one hundredth of its height. That's handy for full-bleed sections and fluid type, but designs come in pixels at a fixed artboard size. This calculator converts in both directions. Enter a pixel value and a viewport (pick a preset such as a 1440 × 900 desktop, a 390 × 844 iPhone or a 768 × 1024 iPad portrait, or enter your own size) and you get the equivalent in vw, vh, vmin and vmax, plus a table showing what that vw value turns into on other screen widths, so you can spot text that becomes tiny on phones or huge on wide monitors. Switch direction to turn a vw, vh, vmin or vmax value into pixels on each common screen. Notes explain how the mobile-friendly dvh, svh and lvh units relate, and how to combine vw with rem inside clamp() so fluid text still respects zoom. Everything runs locally.

Built and maintained by Abhi JainUpdated

How to Convert PX to VW

  1. 1

    Choose a direction

    Select px → vw / vh or vw / vh → px.

  2. 2

    Enter the value

    Type the pixel value, or the viewport value and its unit.

  3. 3

    Pick a viewport

    Choose a device preset or Custom size and enter its width and height.

  4. 4

    Copy the result

    Copy the value you need and check the table for other screens.

Viewport Unit Calculator: questions and answers

How do I convert px to vw?

Divide the pixels by the viewport width and multiply by 100: vw = px ÷ viewport width × 100. On a 1440px-wide design, 72px is 72 ÷ 1440 × 100 = 5vw.

What is the difference between vh and dvh?

On mobile, the browser's address bar shows and hides. vh (and lvh) use the largest visible height, svh the smallest and dvh the current one, which changes as the bar moves. Use dvh or svh for full-height sections on phones.

What are vmin and vmax?

vmin is 1% of the smaller side of the viewport and vmax 1% of the larger side. They keep sizes consistent when the device rotates.

Is it OK to set font size in vw?

Not on its own: vw text doesn't grow when people zoom, which fails accessibility guidelines. Combine vw with rem inside clamp() to keep text fluid and zoomable. The CSS Clamp Generator does this for you.

Does 100vw include the scrollbar?

Yes. On desktop browsers with visible scrollbars, 100vw is slightly wider than the visible content area, which can cause a horizontal scrollbar. Use 100% for widths inside the page.