CSS Unit Converter

All tools

Unit options

Conversion
Context

rem uses the base font size. em and % use the parent size. vw and vh use the viewport width and height.

Status
Idle

Live preview

CSS unit preview
16px = 1rem

About CSS Unit Converter

CSS Unit Converter helps convert common CSS units like px, rem, em, %, vw, and vh. It is useful when adapting typography, spacing, breakpoints, and responsive layouts.

You can change the base font size, parent size, viewport width, and viewport height to match your project context instead of relying on fixed assumptions.

How to use it

  1. Enter the value you want to convert.
  2. Choose the source and target CSS units.
  3. Adjust base font size, parent size, or viewport values when needed.
  4. Copy the converted value or CSS rule.

Tips

  • Use 16px as the common default base size for rem conversions.
  • Use parent size when converting em or percent values.
  • Use viewport width for vw and viewport height for vh conversions.
  • Check the preview to understand the visual scale of the converted value.

Related tools

You may also find these tools useful.

CSS unit converter FAQ

How do px and rem differ?
px is an absolute CSS length. rem is relative to the root font size, commonly 16px by default.
When should I use em?
em is relative to the current or parent font size, so it is useful for component-level scaling.
How is percent converted?
Percent conversion depends on a reference size. This tool uses the parent size field as that reference.
How are vw and vh calculated?
1vw is 1% of the viewport width, and 1vh is 1% of the viewport height.