CSS Unit Converter

Convert between CSS units: rem, em, px, %, vw, vh, and more

Enter Value

Type a number and select the unit

Quick:
⚙️ Context Settings
Root: 16px | Viewport: 1920×1080
px
px
px
px
px

Converted Values

Relative Units

Viewport Units

Absolute Units

CSS Unit Reference

UnitNameTypeDescription
pxPixelsabsoluteAbsolute unit, 1px = 1/96 of an inch
remRoot EmrelativeRelative to root element font-size
emEmrelativeRelative to parent element font-size
%PercentagerelativeRelative to parent element size
vwViewport Widthviewport1vw = 1% of viewport width
vhViewport Heightviewport1vh = 1% of viewport height
ptPointsabsolute1pt = 1/72 of an inch
pcPicasabsolute1pc = 12pt = 1/6 of an inch
inInchesabsolute1in = 96px = 2.54cm
cmCentimetersabsolute1cm = 96px/2.54
mmMillimetersabsolute1mm = 1cm/10

Common Conversions (at 16px base)

0.625rem
= 10px
0.75rem
= 12px
0.875rem
= 14px
1rem
= 16px
1.125rem
= 18px
1.25rem
= 20px
1.5rem
= 24px
2rem
= 32px

Understanding CSS Units: Which Should You Use?

Choosing the right CSS unit is critical for building responsive, accessible, and maintainable web interfaces. Web developers frequently debate whether to use px (pixels), rem (root em), em, or Viewport units like vh/vw. This converter allows you to quickly translate values across these dynamic units depending on your root or parent contexts.

Absolute Units (px)

Pixels (`px`) are the most foundational CSS unit. They map to exact screen configurations and provide strict, unchanging sizes. However, using `px` for font sizes is generally discouraged for accessibility reasons—it prevents users from scaling their browser's default font size. Pixels should mostly be used for borders, subtle shadows, or spacing where exact precision is required regardless of user settings.

Relative Units (rem & em)

Relative units scale dynamically. REM (Root EM) calculates proportionally against the root `html` font size (defaulting to 16px in most browsers). Using `1rem` means 16px, `2rem` is 32px, and so on. `rem` is heavily recommended for typography, padding, and margins to ensure scaling UI accommodates all user accessibility settings.

EM scales proportionally based on its direct parent font size. If a parent container is set to `20px`, a child set to `2em` becomes `40px`. While incredibly useful for modular components (like a button scaling completely on its own `font-size`), `em` can cause compounding size issues if nested too deeply.

Viewport Units (vw, vh, vmin, vmax)

Viewport percentages describe size relative to the visible browser window itself. `1vw` represents 1% of the viewport's total width, meaning `100vw` fills the screen horizontally. These units shine for layout constraints, full-screen hero sections (`min-height: 100vh`), or fluid typography architectures that naturally shrink and grow with window resizes without standard breakpoints.