Convert px to rem, em, vh, vw, pt and back โ instantly. Set your base font size for accurate results.
CSS unit conversion is a constant task for web developers โ calculating rem values for pixel measurements, converting to viewport-relative units for responsive layouts, or verifying pt values for print stylesheets. Set your base font size and viewport dimensions, enter any value, and get instant conversions to rem, em, vw, vh and pt. Click any result to copy it directly.
px (pixels) is the most common CSS unit โ fixed size regardless of parent. rem (root em) is relative to the root HTML font size (typically 16px by default in browsers). em is relative to the parent element's font size. vw/vh are percentages of the viewport width and height โ 1vw = 1% of viewport width. pt (points) is used for print media: 1pt โ 1.333px.
Using rem instead of px for font sizes and spacing makes layouts more accessible โ when a user increases their browser font size, rem-based layouts scale accordingly while px-based ones do not.
Frequently Asked Questions
By default 1rem = 16px (browser default root font size). You can change the base in the converter settings above.
rem is relative to the root (html) element font size โ it's consistent everywhere. em is relative to the parent element font size, which can chain and compound in nested elements.
Set your viewport height above, enter your px value, and the vh result shows automatically. Formula: vh = px / viewportHeight ร 100.
16px = 1rem at the default browser font size of 16px.
rem is recommended for font sizes โ it respects the user's browser font size preferences, making your site more accessible. Use px for borders, shadows and decorative elements that should not scale.
Most browsers default to 16px. If your project sets a custom root font size (e.g. html { font-size: 62.5% } for 10px base), enter that value in the Base font size field.
Use rem for consistent sizing relative to the root โ it does not compound in nested elements. Use em when you specifically want sizing relative to a parent element, such as in component-level typography scales.