At the default root font size of 16px, 18px is exactly 1.125rem.
Calculation based on a root font-size of 16 pixels.
How to convert 18px to rem
To convert pixels to rem, divide the pixel value by the root font size: rem = px ÷ 16. For 18px that is 18 ÷ 16 = 1.125rem.
18px is a medium size, common for body text, subheadings, buttons and standard spacing. It is often used for comfortable, slightly larger body text.
18px at different root font sizes
| Root font size | Input | Result |
|---|---|---|
| 10px | 18px | 1.8rem |
| 12px | 18px | 1.5rem |
| 14px | 18px | 1.2857rem |
| 15px | 18px | 1.2rem |
| 16px | 18px | 1.125rem |
| 18px | 18px | 1rem |
| 20px | 18px | 0.9rem |
| 22px | 18px | 0.8182rem |
| 24px | 18px | 0.75rem |
CSS examples
font-size: 1.125rem; /* 18px */
padding: 1.125rem;
margin-bottom: 1.125rem;
width: 1.125rem;The same values in pixels, if you need a fixed size:
font-size: 18px;
padding: 18px;Tailwind CSS equivalent
As a font size, 1.125rem is the default text-lg class.
Nearby values
Frequently Asked Questions
18px equals 1.125rem when the root font size is the browser default of 16px. The calculation is 18 ÷ 16 = 1.125.
1.125rem equals 18px at a 16px root font size (1.125 × 16 = 18).
Yes. If the root font size is 18px, 18px equals 1rem, and at 20px it equals 0.9rem. 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.
