How do I convert px to vw?
Divide the pixel value by the viewport width and multiply by 100: vw = px / viewport * 100. At a 1440px viewport, 16px = 16 / 1440 * 100 = 1.111vw.
1vw is 1% of the viewport width, so px / viewport width * 100 = vw. At a 1440px screen, 16px = 1.111vw.
Convert any pixel value to viewport width units for fluid, responsive CSS, or go back from vw to px.
1.111vw
16px / 1440px * 100 = 1.111vw
width: 1.111vw;Pixels to viewport width
| Pixels | Viewport width |
|---|---|
| 1px | 0.069vw |
| 2px | 0.139vw |
| 4px | 0.278vw |
| 8px | 0.556vw |
| 10px | 0.694vw |
| 12px | 0.833vw |
| 14px | 0.972vw |
| 16px | 1.111vw |
| 18px | 1.25vw |
| 20px | 1.389vw |
| 24px | 1.667vw |
| 32px | 2.222vw |
| 40px | 2.778vw |
| 48px | 3.333vw |
| 64px | 4.444vw |
| 80px | 5.556vw |
| 100px | 6.944vw |
| 120px | 8.333vw |
| 160px | 11.111vw |
| 200px | 13.889vw |
| 320px | 22.222vw |
| 375px | 26.042vw |
| 768px | 53.333vw |
| 1440px | 100vw |
| Pixels | VW |
|---|---|
| 1px | 0.069vw |
| 2px | 0.139vw |
| 4px | 0.278vw |
| 8px | 0.556vw |
| 10px | 0.694vw |
| 12px | 0.833vw |
| 14px | 0.972vw |
| 16px | 1.111vw |
| 18px | 1.25vw |
| 20px | 1.389vw |
| 24px | 1.667vw |
| 32px | 2.222vw |
| 40px | 2.778vw |
| 48px | 3.333vw |
| 64px | 4.444vw |
| 80px | 5.556vw |
| 100px | 6.944vw |
| 120px | 8.333vw |
| 160px | 11.111vw |
| 200px | 13.889vw |
| 320px | 22.222vw |
| 375px | 26.042vw |
| 768px | 53.333vw |
| 1440px | 100vw |
Use vw for fluid widths, full-bleed sections and type that should scale with the screen. For text, pair it with rem inside clamp() so the size has a floor and a ceiling, for example font-size: clamp(1rem, 2.5vw, 2rem).
Avoid vw for body text on its own: vw ignores the browser zoom and font-size setting, so visitors who enlarge text get no benefit. Keep body copy in rem and reserve vw for the fluid middle of a clamp() range.
Pair the converter with rem sizing, fluid type and responsive breakpoints.
Divide the pixel value by the viewport width and multiply by 100: vw = px / viewport * 100. At a 1440px viewport, 16px = 16 / 1440 * 100 = 1.111vw.
100vw is the full width of the viewport, so 1vw is 1% of it. A 50vw element is half the screen wide at every size, which is why vw is used for full-bleed sections and fluid type.
100vw includes the vertical scrollbar width in most browsers, so a 100vw element is slightly wider than the visible content area and pushes the page sideways. Use width: 100% instead, or account for the scrollbar with calc(100vw - (100vw - 100%)).
Not on its own. vw text ignores the visitor's browser zoom and font-size setting, which hurts accessibility. Pair it with rem inside clamp(), for example font-size: clamp(1rem, 2.5vw, 2rem), so the text still scales with user preferences.