px to rem Converter
Convert between px, rem, em, pt, vw and vh with configurable root font size, parent font size and viewport, showing every unit at once.
Assumptions
Conversion
| Unit | Value | |
|---|---|---|
| px | 24 | |
| rem | 1.5 | |
| em | 1.5 | |
| pt | 18 | |
| vw | 1.6667 | |
| vh | 2.6667 |
rem is relative to the root html font size, 16px by default. Changing that one value rescales every rem on the site, which is why it beats px for responsive layouts.
em is relative to the **parent** font size and compounds through nesting: 0.8em three levels deep is 0.8 cubed. That compounding is why em causes trouble and is worth avoiding.
vw and vh are relative to the viewport; 1vw is 1% of its width. Mobile browsers resize the viewport when the address bar hides, so 100vh often clips content — dvh is the modern fix.
pt is a print unit (1/72 inch); in CSS 1pt = 4/3 px. For screen typography prefer px or rem.
Comments
No comments yet — be the first to say something