frontendhack-logo
21px = 1.3125rem

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

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

How to convert 21px to rem

To convert pixels to rem, divide the pixel value by the root font size: rem = px ÷ 16. For 21px that is 21 ÷ 16 = 1.3125rem.

21px is a medium size, common for body text, subheadings, buttons and standard spacing.

21px at different root font sizes

Root font sizeInputResult
10px21px2.1rem
12px21px1.75rem
14px21px1.5rem
15px21px1.4rem
16px21px1.3125rem
18px21px1.1667rem
20px21px1.05rem
22px21px0.9545rem
24px21px0.875rem

CSS examples

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

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

font-size: 21px;
padding: 21px;

Tailwind CSS equivalent

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

Nearby values

PixelsREM
21px1.3125rem
2px0.125rem
3px0.1875rem
4px0.25rem
5px0.3125rem
6px0.375rem

Frequently Asked Questions

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

1.3125rem equals 21px at a 16px root font size (1.3125 × 16 = 21).

Yes. If the root font size is 18px, 21px equals 1.1667rem, and at 20px it equals 1.05rem. The pixel value itself never changes, only the rem equivalent. 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.