How do I convert 24px to rem with the default 16px base?
- Value
- 24
- Base Font Size (px)
- 16
- Conversion Direction
- Pixels (px) → Rem
- Set Value to 24, Base Font Size to 16 and Direction to Pixels (px) → Rem.
- Divide 24 by 16 to get 1.5; the tool rounds to 4 decimals and displays 1.5rem with CSS font-size: 1.5rem; /* 24px */.
- Rem Value
- 1.5rem
- CSS Code
- font-size: 1.5rem; /* 24px */
1.5rem scales with the root font size, so it grows or shrinks with user settings, unlike a fixed 24px. The CSS comment keeps the original pixel value for reference only.
