Convertisseur d'unités CSS
Convert between px, rem, em, vw, vh, pt, cm, mm, in, and % with configurable context.
Context Settings
Convert
Results
CSS Unit Reference
Absolute Units
- px · Pixels (1/96 of 1 inch)
- pt · Points (1/72 of 1 inch)
- cm · Centimeters
- mm · Millimeters
- in · Inches
Relative Units
- rem · Relative to root font size
- em · Relative to parent font size
- vw · 1% of viewport width
- vh · 1% of viewport height
- vmin · 1% of smaller viewport dimension
- vmax · 1% of larger viewport dimension
- % · Percentage of parent element
When should I use rem vs em?
Use rem for consistent sizing (margins, padding, font sizes) · it always references the root. Use em when you want sizing relative to the parent, such as nested components that scale with their context.
Why is px not always equal to a physical pixel?
CSS px is a "reference pixel" defined as 1/96 of an inch at arm's length distance. On high-DPI displays, one CSS px may map to 2 or 3 physical pixels.