40px to rem
40 pixels expressed in rem, the unit that scales when a user changes their browser's font size.
40px=2.5rem
40 ÷ 16 = 2.5 — rem is just pixels divided by the root font size, which defaults to 16px.
| root size | 40px in rem |
|---|---|
| 14px | 2.8571rem |
| 16px | 2.5rem |
| 18px | 2.2222rem |
| 20px | 2rem |
Different value? Use the converter.