frontendhack-logo
21rem = 336px

At the default root font size of 16px, 21rem is exactly 336px.

Calculation based on a root font-size of 16 pixels.

How to convert 21rem to px

To convert rem to pixels, multiply the rem value by the root font size: px = rem × 16. For 21rem that is 21 × 16 = 336px.

336px is a very large size, typically used for hero headings, containers and big layout dimensions.

21rem at different root font sizes

Root font sizeInputResult
10px21rem210px
12px21rem252px
14px21rem294px
15px21rem315px
16px21rem336px
18px21rem378px
20px21rem420px
22px21rem462px
24px21rem504px

CSS examples

font-size: 21rem; /* 336px */
padding: 21rem;
margin-bottom: 21rem;
width: 21rem;

The same values in pixels, if you need a fixed size:

font-size: 336px;
padding: 336px;

Tailwind CSS equivalent

21rem is not part of the default Tailwind scale, but you can use an arbitrary value such as p-[21rem] or text-[21rem].

Nearby values

REMPixels
21rem336px
0.1rem1.6px
0.125rem2px
0.1875rem3px
0.2rem3.2px
0.25rem4px

Frequently Asked Questions

21rem equals 336px when the root font size is the browser default of 16px. The calculation is 21 × 16 = 336.

336px equals 21rem at a 16px root font size (336 ÷ 16 = 21).

Yes. rem is relative to the root font size, so 21rem becomes 378px at an 18px root and 420px at a 20px root. Use the base font size field above to try any value.

Prefer rem for font sizes, spacing and layout so they respect the user's browser font settings and scale for accessibility. Use px for details that should never scale, such as 1px borders or fixed icon sizes.