← back

CSS Units Reference

px ⇄ rem converter

=

Edit any field — px and rem stay in sync using the root font-size.

Units explained

UnitTypeMeaningExample
pxAbsoluteOne CSS pixel (1/96 inch). Fixed regardless of context.border: 1px solid
remRelativeRelative to the root (<html>) font-size. Best for scalable layouts.font-size: 1.5rem
emRelativeRelative to the current element's font-size. Compounds when nested.padding: 0.5em
%RelativePercentage of the parent's corresponding value.width: 50%
vw / vhViewport1% of viewport width / height.height: 100vh
vmin / vmaxViewport1% of the smaller / larger viewport dimension.font-size: 5vmin
chRelativeWidth of the "0" glyph in the current font. Great for text columns.max-width: 60ch
exRelativex-height of the current font.height: 2ex
frGridA fraction of free space in a CSS grid.grid-template-columns: 1fr 2fr
ptAbsolutePoint = 1/72 inch. Common in print.font-size: 12pt
pcAbsolutePica = 12pt.margin: 1pc
cm / mm / inAbsolutePhysical units; mainly for print stylesheets.width: 21cm
dvh / svh / lvhViewportDynamic / small / large viewport height (mobile URL-bar aware).height: 100dvh
deg / turn / radAngleAngles for transforms & gradients. 1turn = 360deg.rotate(45deg)
s / msTimeSeconds / milliseconds for animations.transition: .3s