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

How do I convert px to rem or other CSS units online?

Enter a value, select the source and target units (px, rem, em, pt, vw, vh, %), and get the result instantly. Set your root font size (default 16px) for accurate rem/em calculations. Use the batch converter to paste CSS and replace all px values with rem (or any other unit) at once. A reference table shows common px-to-rem conversions. Everything runs in your browser — your code 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

Frequently Asked Questions

How do I convert px to rem?
Divide the pixel value by your root font size (usually 16px). For example, 24px ÷ 16 = 1.5rem. DevBolt's CSS Unit Converter does this math automatically — enter the pixel value, select px as the source and rem as the target, and the result updates instantly. You can change the base font size in the settings panel to match your project (e.g., 10px if you use the 62.5% root font-size trick). The batch converter replaces all px values in pasted CSS with rem values at once.
What is the difference between rem, em, and px in CSS?
px (pixels) is an absolute unit — 16px is always 16px regardless of context. rem (root em) is relative to the root element's (html) font size — with the default 16px root, 1rem = 16px, 2rem = 32px. em is relative to the parent element's font size and compounds with nesting — 1.5em inside a 1.5em parent renders at 2.25× the grandparent's size. Use rem for consistent, accessible sizing. Use em only when you want size to scale with the parent (e.g., button padding). Use px for borders and box-shadows.
Should I use rem or px for responsive web design?
Use rem for typography, spacing, and media query breakpoints. rem units respect the user's browser font size setting, which is an accessibility requirement under WCAG 2.1. Users with low vision who increase their default font size will see your layout scale accordingly. Use px for fine details like borders, box-shadows, and outlines where exact control matters and scaling isn't needed. Most modern CSS frameworks including Tailwind CSS use rem internally.
How do vw and vh units work in CSS?
vw (viewport width) and vh (viewport height) are relative to the browser viewport size. 1vw = 1% of the viewport width, 1vh = 1% of the viewport height. They are useful for full-screen sections (min-height: 100vh), fluid typography (font-size: clamp(1rem, 3vw, 2rem)), and responsive spacing. Caveat: 100vw includes the scrollbar width, which can cause horizontal overflow — use width: 100% on body/containers instead. On mobile, 100vh may not account for the browser chrome; use dvh (dynamic viewport height) for mobile-aware layouts.

Related Convert Tools