At the default root font size of 16px, 8px is exactly 0.5rem.
Calculation based on a root font-size of 16 pixels.
How to convert 8px to rem
To convert pixels to rem, divide the pixel value by the root font size: rem = px ÷ 16. For 8px that is 8 ÷ 16 = 0.5rem.
8px is a small size, common for captions, labels, small text and tight spacing. It is often used for the core unit of the popular 8-point spacing system.
8px at different root font sizes
| Root font size | Input | Result |
|---|---|---|
| 10px | 8px | 0.8rem |
| 12px | 8px | 0.6667rem |
| 14px | 8px | 0.5714rem |
| 15px | 8px | 0.5333rem |
| 16px | 8px | 0.5rem |
| 18px | 8px | 0.4444rem |
| 20px | 8px | 0.4rem |
| 22px | 8px | 0.3636rem |
| 24px | 8px | 0.3333rem |
CSS examples
font-size: 0.5rem; /* 8px */
padding: 0.5rem;
margin-bottom: 0.5rem;
width: 0.5rem;The same values in pixels, if you need a fixed size:
font-size: 8px;
padding: 8px;Tailwind CSS equivalent
The default spacing scale has a step for 0.5rem: use classes like p-2, m-2, gap-2, w-2 and h-2.
Nearby values
Frequently Asked Questions
8px equals 0.5rem when the root font size is the browser default of 16px. The calculation is 8 ÷ 16 = 0.5.
0.5rem equals 8px at a 16px root font size (0.5 × 16 = 8).
Yes. If the root font size is 18px, 8px equals 0.4444rem, and at 20px it equals 0.4rem. 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.
