All toolsESC
Dev Utilities / PX ↔ REM / Tailwind
PX ↔ REM / Tailwind
Convert pixels to rem units and Tailwind CSS spacing classes. Configurable base font size.
px
REM
1remTailwind
4Pixels
16px
Tailwind spacing scale — standard classes only use increments of 0.25, 0.5, 0.75, and 1 (where 1 unit = 4px). Values outside this scale require arbitrary syntax like [18px].
Reference Tablebase 16px
| PX | REM | Tailwind |
|---|---|---|
| 0px | 0rem | 0 |
| 2px | 0.125rem | 0.5 |
| 4px | 0.25rem | 1 |
| 6px | 0.375rem | 1.5 |
| 8px | 0.5rem | 2 |
| 10px | 0.625rem | 2.5 |
| 12px | 0.75rem | 3 |
| 14px | 0.875rem | 3.5 |
| 16px | 1rem | 4 |
| 20px | 1.25rem | 5 |
| 24px | 1.5rem | 6 |
| 28px | 1.75rem | 7 |
| 32px | 2rem | 8 |
| 36px | 2.25rem | 9 |
| 40px | 2.5rem | 10 |
| 44px | 2.75rem | 11 |
| 48px | 3rem | 12 |
| 56px | 3.5rem | 14 |
| 64px | 4rem | 16 |
| 80px | 5rem | 20 |
| 96px | 6rem | 24 |
| 112px | 7rem | 28 |
| 128px | 8rem | 32 |
| 144px | 9rem | 36 |
| 160px | 10rem | 40 |
| 176px | 11rem | 44 |
| 192px | 12rem | 48 |
| 208px | 13rem | 52 |
| 224px | 14rem | 56 |
| 240px | 15rem | 60 |
| 256px | 16rem | 64 |
| 288px | 18rem | 72 |
| 320px | 20rem | 80 |
| 384px | 24rem | 96 |
Tips
1rem — equals base font size (default 16px)
Tailwind — 1 unit = 0.25rem = 4px
Arbitrary — use [18px] for non-standard values
Accessible — rem scales with user font settings
About PX ↔ REM / Tailwind
Convert pixel values to rem units and Tailwind CSS spacing classes instantly. RAW's PX to REM converter supports configurable base font sizes and shows the closest Tailwind class match. Essential for responsive design workflows and migrating from fixed pixel layouts to relative units.
How to use
- 1Enter a pixel value in the input field.
- 2View the converted rem value and matching Tailwind CSS class.
- 3Adjust the base font size if your project uses a non-standard root size.
- 4Copy any value with one click or browse the reference table for common conversions.
Frequently Asked Questions
What is the default base font size?
Browsers use 16px as the default root font size. This means 1rem = 16px by default. If your project sets a different root font size (e.g., 10px or 14px), adjust the base size in the tool to get accurate conversions.
How does Tailwind CSS spacing work?
Tailwind uses a spacing scale where each unit equals 4px by default (e.g., p-4 = 16px, m-8 = 32px). If your pixel value doesn't match an exact Tailwind class, the tool shows the closest match and the arbitrary value syntax like p-[18px].
Why should I use rem instead of px?
Rem units scale with the user's browser font size setting, making your layout more accessible. Users who increase their default font size for readability will see your entire layout scale proportionally, unlike fixed pixel values.