Advertisement
Base font size (px):
Pixels (px)
REM
EM
rem is relative to the root element font size. em is relative to the current element's parent font size. When the parent is the root, rem and em are equal.
Reference Table
pxremem
4px0.25rem0.25em
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
40px2.5rem2.5em
48px3rem3em
64px4rem4em
Advertisement

Frequently Asked Questions

What is the difference between px, rem, and em?

px (pixels) are absolute units — 1px always equals one physical pixel at 1x scale. rem (root em) is relative to the font size of the root <html> element, typically 16px by default. em is relative to the font size of the element's parent, which can cascade and multiply unpredictably in nested elements.

Why should I use rem instead of px for font sizes?

Using rem allows users to scale your entire site by changing their browser's default font size. This improves accessibility for users with low vision. px ignores browser font size preferences, while rem and em respect them. Most modern design systems recommend rem for typography and spacing.

What base font size should I use?

The default browser font size is 16px, which is the most common base. Some developers set 62.5% (10px) on the html element to make calculations easier (1rem = 10px). However, this can override user preferences and hurt accessibility. It is best practice to leave the root font size at the browser default and work in rem.