CSS Unit Converter - px to rem, em, pt, vw, vh and More

AdSense Placeholder
Slot: header_tool

CSS Unit Converter

Convert any CSS length to every other unit at once

Quick reference
pxrempt

AdSense Placeholder
Slot: tool_mid_article

Every Unit at Once

Type a value in one unit and see it in 14 CSS units, each one-click copyable.

Your Context

Relative units depend on font sizes and the viewport, so you set them yourself.

px to rem Table

Common pixel sizes with their rem and point equivalents for your root size.

Private

Everything runs in your browser; nothing you paste is uploaded.

Which CSS Unit to Use

CSS pixels are not device pixels: by definition 1in = 96px = 72pt = 2.54cm on screen, whatever the display density. rem is relative to the root (html) font size, 16px by default, so 1.5rem = 24px; it respects the user's browser font setting, which makes it the best choice for font sizes and spacing. em and % are relative to the parent's font size and compound when nested.

vw and vh are percentages of the viewport, handy for full-screen sections and fluid type; on mobile, the newer svh, lvh and dvh units deal with browser toolbars. Physical units (cm, mm, in, pt) are mainly useful in print style sheets. For text, avoid pure vw sizes, which do not grow when users zoom; combine them with rem using clamp().

Key Takeaways

  • rem for type: It scales with the user's font preference.
  • 96px per inch: CSS fixes the ratio between pixels and physical units.
  • em compounds: Nested em values multiply, rem values do not.
AdSense Placeholder
Slot: footer_leaderboard