PX to REM converter
Type a pixel or rem value and get the other, plus the Tailwind CSS 4 class. At the default 16px root, rem = px ÷ 16: 24px is 1.5rem, which is p-6 in Tailwind. Below it, paste a stylesheet to convert every value at once.
- REM
- 1.5rem
- PX
- 24px
- Tailwind spacing
- p-6
- Tailwind text size
- text-2xl
- CSS
- padding: 1.5rem;
Spacing works for p-, m-, gap-, w-, h-, inset- and the rest: swap the prefix.
The quick brown fox jumps over the lazy dog
Convert a whole stylesheet
Every px becomes rem (or back). Comments, url() and names like --gap-4px stay as they are.
.card {
padding: 1.5rem 1.25rem;
margin-bottom: 2rem;
border: 1px solid #e4e4e7;
border-radius: 0.75rem;
font-size: 0.9375rem;
line-height: 1.5rem;
gap: 0.75rem;
}
@media (min-width: 48rem) {
.card { padding: 2.5rem; }
}PX to REM table
The values people look up most, at the default 16px root font size, with the Tailwind CSS 4 class for each. For a whole type scale on Tailwind's names, use the font size generator.
| PX | REM | Tailwind spacing | Text size |
|---|---|---|---|
1px | 0.0625rem | p-px | text-[1px] |
2px | 0.125rem | p-0.5 | text-[2px] |
4px | 0.25rem | p-1 | text-[4px] |
6px | 0.375rem | p-1.5 | text-[6px] |
8px | 0.5rem | p-2 | text-[8px] |
10px | 0.625rem | p-2.5 | text-[10px] |
12px | 0.75rem | p-3 | text-xs |
13px | 0.8125rem | p-3.25 | text-[13px] |
14px | 0.875rem | p-3.5 | text-sm |
15px | 0.9375rem | p-3.75 | text-[15px] |
16px | 1rem | p-4 | text-base |
18px | 1.125rem | p-4.5 | text-lg |
20px | 1.25rem | p-5 | text-xl |
22px | 1.375rem | p-5.5 | text-[22px] |
24px | 1.5rem | p-6 | text-2xl |
28px | 1.75rem | p-7 | text-[28px] |
30px | 1.875rem | p-7.5 | text-3xl |
32px | 2rem | p-8 | text-[32px] |
36px | 2.25rem | p-9 | text-4xl |
40px | 2.5rem | p-10 | text-[40px] |
44px | 2.75rem | p-11 | text-[44px] |
48px | 3rem | p-12 | text-5xl |
56px | 3.5rem | p-14 | text-[56px] |
60px | 3.75rem | p-15 | text-6xl |
64px | 4rem | p-16 | text-[64px] |
72px | 4.5rem | p-18 | text-7xl |
80px | 5rem | p-20 | text-[80px] |
96px | 6rem | p-24 | text-8xl |
100px | 6.25rem | p-25 | text-[100px] |
128px | 8rem | p-32 | text-9xl |
A rem-based type and spacing scale, in finished blocks
12 of 147 free, no account. All of them in UI Pro.
01Hero
hero-01 · Free. Journey-planner hero: from/to card with leave-at tabs, a day-out photo card and four quick-task tiles.
Open hero-01
02Plain tiles
features-01 · Free. Three open photo tiles with a step, a title and two lines each under a centred heading; no card chrome.
Open features-01- 03
All free blocks
Every one with a live preview, filtered to the ones you can use for free first.
See them all
Questions
How do I convert px to rem?
Divide the pixel value by the root font size. Browsers use 16px unless the page changes it, so 24px is 24 ÷ 16 = 1.5rem, 14px is 0.875rem and 1px is 0.0625rem. To go back, multiply: 2rem × 16 = 32px.
What is 1rem in px?
1rem is the font size of the html element: 16px by default. If your CSS sets html { font-size: 62.5% }, 1rem is 10px; set the root size above the converter to match your site.
Which Tailwind class is 24px?
p-6, m-6, gap-6, w-6 and the rest of the spacing utilities with 6: Tailwind 4 multiplies the number by --spacing, 0.25rem, so 6 × 0.25rem = 1.5rem = 24px. The rule is px ÷ 4 at the default root size. Tailwind 4 accepts any multiple of 0.25, so 13px is p-3.25; anything else becomes an arbitrary value like p-[13.5px].
Should I use rem or px?
Use rem for font sizes and most spacing: it follows the reader's browser font-size setting, which matters for accessibility. Keep px for hairlines (1px borders) and things that should not grow with text. That is why the stylesheet converter leaves 1px alone unless you tell it otherwise.
Does rem in a media query use my root font size?
No. rem in a media query always uses the browser's initial font size (16px by default), not the size you set on html. Tailwind 4 writes its breakpoints in rem for this reason: md is 48rem, which is 768px at the default size.
Is it free?
Yes. No sign-up, and nothing leaves your browser.
More free tools
- Tailwind font size generatorBuild a font size scale on Tailwind names (text-xs to text-9xl) from a base size and ratio, with line heights, for v4 @theme or a v3 config.
- Tailwind CSS cheat sheetSearch 470 Tailwind CSS 4 classes with the exact CSS each writes, plus breakpoints, spacing, font sizes, radius and container sizes. Generated by Tailwind itself.
- CSS gradient generatorLinear, radial and conic gradients on a large live preview, copied as Tailwind CSS 4 classes (bg-linear, from, via, to), plain CSS or an @theme token.
- Box shadow generatorLayer box shadows on a real card, light or dark, and copy them as a Tailwind CSS 4 class, plain CSS or an @theme token. Paste a shadow to edit it.
UI Pro
Build your next site from finished blocks
Every block, page template and website theme from €199, paid once, with every update and everything we add later. Not ready? The free blocks are open to everyone.
- blocks
- 1401
- page templates
- 55
- website themes
- 29

This card is a UI Pro block: Rooilijn (call-to-action-07).