Px to Rem Converter

Convert between px, rem, and em units instantly. Adjust the base font size, see a live preview, and copy values. All client-side.

Base Font Size
px
px
= 1rem
rem
= 16px
Visual Preview

The quick brown fox

16px1rem1em
Quick Reference (base: 16px)
PixelsRemEmCopy
8px0.5rem0.5em
10px0.625rem0.625em
12px0.75rem0.75em
14px0.875rem0.875em
16px1rem1em
18px1.125rem1.125em
20px1.25rem1.25em
24px1.5rem1.5em
28px1.75rem1.75em
32px2rem2em
36px2.25rem2.25em
40px2.5rem2.5em
48px3rem3em
56px3.5rem3.5em
64px4rem4em
72px4.5rem4.5em
80px5rem5em
96px6rem6em

Understanding CSS Units: Px, Rem, and Em

CSS offers a variety of units for sizing elements, but three dominate everyday development: pixels, rem, and em. Pixels are the simplest — they map to device pixels (adjusted by the device pixel ratio) and produce predictable, rigid layouts. But rigidity is a drawback when building accessible, responsive interfaces.

Rem and em are relative units that create fluid, scalable designs. Rem is always relative to the root element's font size (typically 16px), making it predictable and consistent. Em is relative to the current element's parent font size, which makes it powerful for component-scoped scaling but tricky when elements are deeply nested.

Rem vs Em vs Px: When to Use Each

Use rem as your default unit for font sizes, spacing, and layout dimensions. It creates a consistent scale anchored to a single base value, and it respects user accessibility settings. If a user increases their browser's default font size, rem-based layouts adapt automatically.

Use em when you want an element to scale relative to its own font size — for example, padding on a button that should always be proportional to its text. Use px for borders, outlines, box shadows, and any detail where you need pixel-precise control that shouldn't change with font size.

Responsive Design with Relative Units

Responsive design is about more than media queries. Using relative units like rem ensures your typography, spacing, and layout proportions stay harmonious across screen sizes. A heading set to 2rem is always twice the body text, regardless of the base size.

Many modern CSS frameworks, including Tailwind CSS, use a rem-based spacing scale (0.25rem, 0.5rem, 1rem, etc.) precisely for this reason. Combined with fluid typography techniques (clamp() with rem), relative units enable designs that smoothly adapt from mobile to ultrawide displays without abrupt breakpoints.

Accessibility and CSS Units

WCAG Success Criterion 1.4.4 requires that text can be resized up to 200% without loss of content or functionality. Layouts built with px-based font sizes often break this requirement because they don't respond to the user's text size preferences. Rem-based sizing solves this by inheriting from the root font size.

Beyond compliance, relative units are simply good UX. Users with low vision, dyslexia, or cognitive disabilities often adjust their browser's default font size. Respecting that preference with rem/em units costs nothing in development effort but significantly improves usability for millions of people.

Frequently Asked Questions

Related Tools

Explore More Tools

Find this tool useful? Buy us a coffee to keep DuskTools free and ad-light.