CSS tool
px to rem Converter / rem to px Converter
Do you want CSS Clamp Generator?A px to rem converter that is also a rem to px converter and a px to rem calculator. Root defaults to 16px. Convert em the same way. Specific values like 80 px to rem or 1.5 rem to px stay in this tab. It all stays on your computer.
Like the tool? Find a bug?Get in touch :)Calculator
A px to rem converter and rem to px converter, plus em. Root defaults to 16px. Type 80px or 1.5rem, or paste 80 px to rem. Numbers stay on your device.
16px = 1rem at a 16px root. 1em if the parent is 16px.
12px to 64px chart
| px | rem | em | Load |
|---|---|---|---|
| 12px | 0.75rem | 0.75em | |
| 14px | 0.875rem | 0.875em | |
| 16px | 1rem | 1em | |
| 18px | 1.125rem | 1.125em | |
| 20px | 1.25rem | 1.25em | |
| 24px | 1.5rem | 1.5em | |
| 28px | 1.75rem | 1.75em | |
| 32px | 2rem | 2em | |
| 36px | 2.25rem | 2.25em | |
| 40px | 2.5rem | 2.5em | |
| 48px | 3rem | 3em | |
| 56px | 3.5rem | 3.5em | |
| 64px | 4rem | 4em |
font-size: 1rem; /* 16px */
text-[1rem]
const root = 16;
export function pxToRem(px: number) {
return `${px / root}rem`;
}
export function remToPx(rem: number) {
return rem * root;
}