Viewport Unit Converter
Convert between px and viewport units (vw, vh, vmin, vmax, dvh, svh, lvh, container query units). Includes batch conversion and fluid clamp() generator.
Viewport Unit Converter
🔀 Conversion Mode
📏 Unit Type
Classic viewport width (1vw = 1% of viewport width)
Decimals
Viewport Dimensions
Input Value
Result
Quick Snippets
Batch Conversion
Enter multiple values (one per line or comma-separated)
Fluid clamp() Generator
Create responsive values that scale between breakpoints
Formula: clamp(min, calc(slope × 100vw + intercept), max)
Tip: Use vw for widths, vh for heights, vmin/vmax for responsive squares
Viewport units: Based on browser viewport (vw, vh, vmin, vmax)
Small viewport: Smallest possible viewport (mobile with UI visible)
Large viewport: Largest possible viewport (mobile with UI hidden)
Dynamic viewport: Adjusts as browser UI appears/disappears
Container query: Based on container size, not viewport
What is a Viewport Unit Converter?
A viewport unit converter is a tool that translates pixel (px) values into CSS viewport-relative units: vw, vh, vmin, vmax: and modern units like dvh (dynamic viewport height), svh (small viewport height), and container query units (cqw, cqh). These units are essential for building truly responsive layouts that adapt to any screen size without fixed breakpoints.
CodeHelper's Viewport Unit Converter includes 18 device presets, batch conversion, and a built-in fluid clamp() generator.
Modern CSS Viewport Units Explained
- vw / vh: Classic viewport width and height. 1vw = 1% of the viewport width.
- dvh: Dynamic viewport height: adjusts when the browser's address bar shows or hides on mobile.
- svh / lvh: Small and large viewport height variants for stable full-screen layouts.
- cqw / cqh: Container query units that respond to the parent container's size, not the viewport.
How to convert px to vw/vh
- Select a device preset or enter a custom viewport width/height.
- Enter the pixel value you want to convert.
- Choose the target unit (vw, vh, dvh, cqw, etc.).
- Use batch mode to convert multiple values at once.
- Copy the generated CSS value or clamp() expression.
Whether you are building mobile-first layouts, fixing the classic "100vh on iOS" problem with dvh, or implementing container query-based components, this free viewport unit calculator is an indispensable tool.
Related
Free forever, no ads, no tracking. Support the project