CSS Unit Converter

Convert between CSS length units — px, rem, em, vw, vh, pt, pc, cm, mm, and in — with configurable viewport size and root font size. Understanding how units relate to each other is essential for responsive design: rem scales with the root font size, vw with the viewport width, and px is absolute. Set your project's root and viewport dimensions once and convert any value instantly.

All processing happens in your browser. No data is sent to any server.

Frequently Asked Questions

What is the difference between rem and em?
rem (root em) is always relative to the root element's font size (html), typically 16px. em is relative to the font size of the element itself — which compounds when elements are nested, making it harder to reason about. rem is generally preferred for font sizes and spacing in modern CSS because it's predictable.
When should I use px vs. rem?
Use rem for font sizes and spacing so your layout respects the user's browser font size preference. Use px for things that should not scale with text — borders, fixed-size elements, and media query breakpoints. Mixing units intentionally is fine; mixing them accidentally is a common source of layout bugs.
What are vw and vh units?
vw (viewport width) and vh (viewport height) are relative to the browser window size. 1vw = 1% of the viewport width. They're useful for full-bleed sections, fluid typography, and responsive layouts that react to window size rather than parent element size.
What viewport size should I use for vw/vh conversions?
Use the viewport width and height that represents your primary design target — common choices are 375px (iPhone), 768px (tablet), or 1440px (desktop). The vw/vh values will be proportionally different at other viewport sizes, which is the point of using them.

Related Tools