Advertisement

CSS Unit Converter

Convert between CSS units: px, rem, em, vh, and vw. Set a custom root font size and viewport dimensions. Includes a visual preview of the actual rendered size.

Value
Unit
px
px
px
px
pxSource
16px
rem
1rem
em
1em
vh
1.4815vh
vw
0.8333vw
Visual Preview
16px

How to Use the CSS Unit Converter

Enter a value, select the source unit (px, rem, em, vh, or vw), and see all equivalent values instantly. Adjust the root font size if your project uses a custom base (the browser default is 16px). Set custom viewport dimensions for accurate vh/vw conversions. The visual preview shows the actual rendered size in pixels. Pick your colors with the color converter to complement your sizing.

What Are CSS Units?

CSS offers multiple unit types for sizing elements. Pixels (px) are absolute units tied to device pixels. remis relative to the root element's font size — ideal for consistent, accessible sizing. emis relative to the parent element's font size, useful for components that scale with their context. Viewport units (vh and vw) represent percentages of the viewport height and width, perfect for full-screen layouts and responsive design.

Common Use Cases

Convert a designer's pixel values to rem for accessible styling. Calculate how many pixels 1rem equals in a project with a custom root font size. Determine vw values for fluid typography. Quickly reference em equivalents when building scalable component libraries. Create responsive gradients with the CSS Gradient Generator. The visual preview helps verify that your converted values produce the expected size on screen. For physical unit conversions, see the unit converter.

Advertisement

Frequently Asked Questions

Related Tools