How do I convert px to rem or other CSS units online?
Enter a value, select the source and target units (px, rem, em, pt, vw, vh, %), and get the result instantly. Set your root font size (default 16px) for accurate rem/em calculations. Use the batch converter to paste CSS and replace all px values with rem (or any other unit) at once. A reference table shows common px-to-rem conversions. Everything runs in your browser — your code never leaves your device.
Value: 24px Base font size: 16px
24px = 1.5rem Quick reference (base 16px): 12px = 0.75rem 14px = 0.875rem 16px = 1rem 24px = 1.5rem 32px = 2rem
CSS Unit Converter
Convert between px, rem, em, pt, vw, vh, and % with configurable base sizes.
1rem
Batch Converter
Paste CSS and replace all unit values at once.
px ↔ rem Reference Table
Base font size: 16px
| px | rem | em | pt |
|---|---|---|---|
| 4px | 0.25rem | 0.25em | 3pt |
| 8px | 0.5rem | 0.5em | 6pt |
| 10px | 0.625rem | 0.625em | 7.5pt |
| 12px | 0.75rem | 0.75em | 9pt |
| 14px | 0.875rem | 0.875em | 10.5pt |
| 16px | 1rem | 1em | 12pt |
| 18px | 1.125rem | 1.125em | 13.5pt |
| 20px | 1.25rem | 1.25em | 15pt |
| 24px | 1.5rem | 1.5em | 18pt |
| 28px | 1.75rem | 1.75em | 21pt |
| 32px | 2rem | 2em | 24pt |
| 36px | 2.25rem | 2.25em | 27pt |
| 40px | 2.5rem | 2.5em | 30pt |
| 48px | 3rem | 3em | 36pt |
| 56px | 3.5rem | 3.5em | 42pt |
| 64px | 4rem | 4em | 48pt |
| 72px | 4.5rem | 4.5em | 54pt |
| 80px | 5rem | 5em | 60pt |
| 96px | 6rem | 6em | 72pt |
| 128px | 8rem | 8em | 96pt |
Press Enter to copy result
Tips & Best Practices
Use rem for typography, px for borders, % or vw/vh for layout
rem scales with the user's font size preference (accessibility). px is precise and predictable for borders and shadows. Viewport units (vw/vh) and percentages create fluid layouts. Mixing these purposefully is better than using one unit everywhere.
1rem is not always 16px — users change their base font size
1rem equals the root element's font-size, which defaults to 16px but can be changed by users for accessibility. Designing with rem means your layout respects user preferences. Hardcoding px ignores accessibility settings.
The 62.5% trick: set html { font-size: 62.5% } for easy rem math
With 62.5%, 1rem = 10px, making conversions trivial: 14px = 1.4rem, 20px = 2rem. Body text then gets `font-size: 1.6rem` (16px). This preserves rem's accessibility benefits while eliminating mental math.
Viewport units can leak information about screen size
In sensitive applications, CSS that uses vw/vh can be probed via JavaScript to determine exact screen dimensions. This is a minor fingerprinting vector but relevant for privacy-sensitive applications where you want to minimize device identification.
Frequently Asked Questions
How do I convert px to rem?
What is the difference between rem, em, and px in CSS?
Should I use rem or px for responsive web design?
How do vw and vh units work in CSS?
Related Convert Tools
Case Converter
Convert text between camelCase, snake_case, kebab-case, and more
Number Base Converter
Convert numbers between binary, octal, decimal, and hex
CSV ↔ JSON Converter
Convert between CSV and JSON formats with custom delimiters
URL Encoder & Decoder
Encode and decode URLs with encodeURIComponent and encodeURI