DevBolt
Processed in your browser. Your data never leaves your device.

px to rem Converter & Guide

Convert pixels to rem units instantly. Set your root font size (default 16px) and get accurate rem values for any pixel measurement. Paste CSS to batch-convert all px values to rem. All processing happens in your browser — your data never leaves your device.

← Back to tools

CSS Unit Converter

Convert between px, rem, em, pt, vw, vh, and % with configurable base sizes.

Result

1rem

Batch Converter

Paste CSS and replace all unit values at once.

with

px ↔ rem Reference Table

Base font size: 16px

pxremempt
4px0.25rem0.25em3pt
8px0.5rem0.5em6pt
10px0.625rem0.625em7.5pt
12px0.75rem0.75em9pt
14px0.875rem0.875em10.5pt
16px1rem1em12pt
18px1.125rem1.125em13.5pt
20px1.25rem1.25em15pt
24px1.5rem1.5em18pt
28px1.75rem1.75em21pt
32px2rem2em24pt
36px2.25rem2.25em27pt
40px2.5rem2.5em30pt
48px3rem3em36pt
56px3.5rem3.5em42pt
64px4rem4em48pt
72px4.5rem4.5em54pt
80px5rem5em60pt
96px6rem6em72pt
128px8rem8em96pt

Press Enter to copy result

How to convert px to rem

The formula is simple: rem = px / root-font-size. With the browser default of 16px, 1rem equals 16px. So 24px is 1.5rem, 14px is 0.875rem, and 32px is 2rem. If your project sets html { font-size: 62.5% } (a common Tailwind/CSS reset trick), the base becomes 10px, making the math easier: 16px = 1.6rem, 20px = 2rem. Use the settings panel to match your project's root font size for accurate conversions.

Why use rem instead of px

rem units are relative to the root font size, so they scale automatically when users change their browser font size (an accessibility requirement under WCAG 2.1). Pixels are fixed and don't respect user preferences. Using rem for font-size, padding, margin, and media queries makes your site accessible to users with low vision who increase their default font size. Most CSS frameworks (Tailwind, Bootstrap 5) use rem internally. The general rule: use rem for typography and spacing, px for borders and box-shadows where exact control matters.

Batch-convert px to rem in CSS files

Paste your CSS into the batch converter, set 'Replace px with rem', and all pixel values are converted instantly. This is faster than find-and-replace because it handles the math automatically — 16px becomes 1rem, 24px becomes 1.5rem, etc. The converter preserves your CSS structure, comments, and non-px values. Use this when migrating a legacy codebase from px to rem or when reviewing design tokens from Figma/Sketch that export in pixels.

Frequently Asked Questions

How many rem is 16px?

With the default root font size of 16px, 16px equals exactly 1rem. The formula is rem = px / root-font-size, so 16 / 16 = 1.

What base font size should I use for rem conversion?

Most browsers default to 16px. If your CSS sets html { font-size: 62.5% }, the base is 10px. If you use html { font-size: 100% } or don't set it, the base is 16px. Match this tool's settings to your project's root font size for accurate conversions.

Should I use rem or em for CSS?

Use rem for most cases — it's relative to the root font size, so it's consistent and predictable. Use em only when you want an element to scale relative to its parent's font size (e.g., padding inside a button that should grow with the button's text). Mixing em and rem in deep nesting causes compounding issues, so rem is safer.

Related Convert Tools