PX to EM/REM Converter
Convert between px, em, and rem CSS units with configurable base font size. Includes conversion table and CSS output.
Default browser font size is 16px. Adjust if your project uses a different root font size.
Convert
font-size: 1rem; /* 16px at 16px base */Conversion Table (base: 16px)
| Pixels | EM | REM | Preview |
|---|---|---|---|
| 8px | 0.5em | 0.5rem | Aa |
| 10px | 0.625em | 0.625rem | Aa |
| 12px | 0.75em | 0.75rem | Aa |
| 14px | 0.875em | 0.875rem | Aa |
| 16px | 1em | 1rem | Aa |
| 18px | 1.125em | 1.125rem | Aa |
| 20px | 1.25em | 1.25rem | Aa |
| 24px | 1.5em | 1.5rem | Aa |
| 28px | 1.75em | 1.75rem | Aa |
| 32px | 2em | 2rem | Aa |
| 36px | 2.25em | 2.25rem | Aa |
| 40px | 2.5em | 2.5rem | Aa |
| 48px | 3em | 3rem | Aa |
| 56px | 3.5em | 3.5rem | Aa |
| 64px | 4em | 4rem | Aa |
| 72px | 4.5em | 4.5rem | Aa |
| 80px | 5em | 5rem | Aa |
| 96px | 6em | 6rem | Aa |
Related Tools
Aspect RatioNEW
Calculate aspect ratios for images and videos. Enter width or height with a ratio (16:9, 4:3, 1:1) to find the other dimension.
CSS Beautifier
Format and beautify messy CSS code. Minify or expand with proper indentation.
CSS MinifyNEW
Minify CSS code to reduce file size. Remove comments, whitespace, and optimize.
Box Shadow
Create CSS box shadows visually. Adjust blur, spread, offset, and color.
Frequently Asked Questions
What is the difference between em and rem?
What is the default browser font size?
Why should I use rem instead of px?
When should I use em vs rem?
How do I set the base font size in CSS?
Does this converter work for all CSS properties?
How to Convert Between PX, EM, and REM
Converting between CSS units is a daily task for web developers building responsive, accessible websites. Our converter lets you instantly translate between pixels, em, and rem units with a configurable base font size, complete with a handy reference table.
Step 1: Set your base font size. The default is 16px (the browser default). If your project uses a different root font size, change this value to get accurate conversions. All calculations are based on this base value.
Step 2: Enter a value in any unit. Type a number in the px, em, or rem field. The other two fields update instantly with the converted values. The conversion is bidirectional: enter pixels to get em/rem, or enter em/rem to get pixels.
Step 3: Use the reference table. The conversion table shows common pixel values and their em/rem equivalents at your chosen base size. This is perfect for quick lookups when writing CSS without needing to calculate each time.
Understanding CSS Relative Units
CSS provides several relative units for responsive design. Pixels (px) are absolute units tied to device pixels. Em units are relative to the computed font-size of the element (or parent for font-size itself). Rem units are always relative to the root element font-size, making them predictable and consistent across the document.
The shift from pixel-based to relative-unit-based design is driven by accessibility requirements and responsive design needs. Users who set larger default font sizes in their browsers (for vision accessibility) benefit from rem-based designs that scale proportionally. WCAG 2.1 Success Criterion 1.4.4 requires text to be resizable up to 200% without loss of content or functionality, which is naturally supported by rem-based layouts.
CSS Unit Best Practices
Use rem for global sizing. Font sizes, margins, padding, and widths that should maintain consistent proportions across the page work best with rem. This ensures everything scales uniformly when the user changes their preferred font size.
Use em for component-relative sizing. When button padding should scale with the button text size, or when an icon should match its adjacent text, em units create proportional relationships within a component. Increasing the component font-size automatically scales all em-based dimensions.
Use px for borders and shadows. Fine details like 1px borders, box shadows, and outlines often look best at fixed pixel sizes. A 1px border remains crisp at any scale, while 0.0625rem might render inconsistently across browsers and zoom levels.