px → rem Converter
Convert pixels to rem, see the result live on real HTML elements, batch-convert CSS snippets, and browse a full reference table.
Page Heading
Section Heading
Subsection Heading
The quick brown fox jumps over the lazy dog.
Helper text, label, or caption
First line of text
Second line of text
border-radius
Common px values converted to rem, em, and % — updates instantly when you change the base font size above.
| px | rem | em | % | pt |
|---|
Paste any CSS snippet — all px values are converted to
rem instantly using your current base font size.
px vs. rem — What's the Difference?
px (pixels) is an absolute unit. 16px is always 16 pixels on screen
regardless of user settings. It is predictable but rigid.
rem (root em) is a relative unit. 1rem equals the font size of the
<html> element (root). Browsers default this to 16px, so
1rem = 16px by default — but users can change their browser's base font size, and
rem-based layouts scale with it.
Why Use rem Instead of px?
Accessibility. When a user increases their system or browser font size (common for users with low vision), rem-based layouts scale proportionally. px layouts do not — they override the user's preference.
Scalability. You can change the entire site's scale by adjusting a single CSS rule
on the html element. Reducing html { font-size: 14px; } shrinks everything
proportionally.
Design systems. Spacing and typography tokens in rem make it easy to enforce consistent rhythm across a design system.
The 62.5% Trick
Many developers set html { font-size: 62.5%; }, which makes 1rem = 10px
(since 62.5% of 16px = 10px). This makes mental arithmetic much easier — 24px becomes
2.4rem instead of 1.5rem.
rem vs. em
rem is always relative to the root (<html>). em
is relative to the nearest parent. This makes em compounding — a nested element with
font-size: 1.2em inside a parent with font-size: 1.2em will actually
render at 1.44em (1.2 × 1.2). rem avoids this compounding completely.
Use rem for font sizes, spacing, and layout dimensions. Use em only when
you intentionally want an element to scale with its parent — common for padding inside a button (so
padding scales with the button's font size).
When to Keep px
- 1px borders —
border: 1px solidis intentionally thin and should stay as px. - Box shadows — shadow blur and spread values are cosmetic, not layout-critical.
- Media query breakpoints — use px (or em) for breakpoints; rem in media queries behaves inconsistently across browsers.
- Icons and images — fixed icon sizes in px can be appropriate if they shouldn't scale with text.