px, rem and em both ways with any root size, plus bulk CSS rewrite
Viewport Unit Calculator
Know exactly how many pixels a viewport unit gives on the screens you care about.
Loading tool…
How to use viewport unit calculator
Pick a common screen or type a viewport width and height, or use this window's size.
Enter a value and its unit: px, vw, vh, vmin or vmax.
Read the same length in every other unit.
Use the reference table for 1, 5, 10, 25, 50 and 100 of each unit.
What this tool does
- Converts between px, vw, vh, vmin and vmax in any direction.
- Includes phone, tablet, laptop and desktop sizes in CSS pixels.
- Can read the current browser window's size.
How the result is verified
1vw is always one hundredth of the width and 1vh one hundredth of the height; vmin and vmax use the smaller and larger side. Each stat shows the px size of one unit so you can check by hand.
Frequently asked questions
Does vw include the scrollbar?
Yes. 100vw is the full viewport width including a classic scrollbar, which is why width: 100vw can cause sideways scrolling on desktop browsers that show one.
Why is 100vh too tall on phones?
Mobile browsers size vh as if their toolbars were hidden. Use svh for the height with toolbars showing, or dvh for a value that follows them.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Fluid clamp() between two viewport widths, verified at real widths
Fluid font size and line height with a device table and zoom check
Snap sizes to an 8px grid and plan columns, gutters and margins