Free tool

PX to REM Converter

Type a pixel or rem value and get the other unit plus the Tailwind spacing class that matches it. Click any row in the reference tables to load it.

In rem
1.5rem
Tailwind spacing
p-6
Tailwind arbitrary
[24px]

24px is on Tailwind's spacing scale (1 unit = 4px), so any spacing utility works: p-6, m-6, gap-6, w-6.

Spacing scale

Class suffixrempx
0.50.125rem2px
10.25rem4px
1.50.375rem6px
20.5rem8px
2.50.625rem10px
30.75rem12px
3.50.875rem14px
41rem16px
51.25rem20px
61.5rem24px
71.75rem28px
82rem32px
92.25rem36px
102.5rem40px
112.75rem44px
123rem48px
143.5rem56px
164rem64px
205rem80px
246rem96px
287rem112px
328rem128px
369rem144px
4010rem160px
4411rem176px
4812rem192px
5213rem208px
5614rem224px
6015rem240px
6416rem256px
7218rem288px
8020rem320px
9624rem384px

Font sizes

Classrempx
text-xs0.75rem12px
text-sm0.875rem14px
text-base1rem16px
text-lg1.125rem18px
text-xl1.25rem20px
text-2xl1.5rem24px
text-3xl1.875rem30px
text-4xl2.25rem36px
text-5xl3rem48px
text-6xl3.75rem60px
text-7xl4.5rem72px
text-8xl6rem96px
text-9xl8rem128px

Frequently asked questions

How many pixels is 1 unit in Tailwind spacing?

One unit is 0.25rem, which is 4px at the default 16px base font size. So p-4 is 16px, p-8 is 32px, and p-0.5 is 2px.

How do I convert px to rem?

Divide the pixel value by the base font size. With the browser default of 16px, 24px is 24 / 16 = 1.5rem.

What is p-px in Tailwind?

p-px is exactly 1 pixel of padding. The same px suffix works for margin, width, height, gap and borders.

Why use rem instead of px?

rem scales with the user's browser font size setting, which keeps layouts readable for people who increase their default text size. Tailwind's spacing and text sizes are rem-based for that reason.

Guides that go with this tool

More free Tailwind CSS tools

Browse all 24 Tailwind CSS tools

More free tools & components

Keep going with another tool, or grab a ready-made component.