Skip to main content

px to rem Converter

Convert pixels to rem and rem to pixels with your own root font size, and see the Tailwind spacing class. Free and private.

Tailwind spacing: 6 (for example p-6, gap-6)

Tailwind text size: text-2xl

Pixelsrem (root 16px)Tailwind spacing
8px0.5rem2
10px0.625rem2.5
12px0.75rem3
14px0.875rem3.5
16px1rem4
18px1.125rem—
20px1.25rem5
24px1.5rem6
28px1.75rem7
32px2rem8
36px2.25rem9
40px2.5rem10
48px3rem12
56px3.5rem14
64px4rem16
72px4.5rem—
96px6rem24

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to CSS clamp() Generator.

Free Online px to rem Converter

Type a size in pixels or in rem and see the other one at once. Set your own root font size, and get the Tailwind class that matches. It gives developers a quick browser-based way to solve a focused px to rem converter task before moving the result into a project.

How to convert px to rem

Type a pixel value in the left box. The rem value appears on the right. Type in the right box to go the other way. The formula is rem = px ÷ root size.

Changing the root size

The root size is 16 px unless your site changes it. If your CSS sets html { font-size: 62.5% }, enter 10.

Common mistakes

  • Using 16 as the root size on a site that changed it: every rem value is then off by a constant factor.
  • Using rem for borders and shadows where one device pixel is wanted: keep px there.

Frequently asked questions

What is rem?
rem is a size that scales with the root font size of the page, which is 16 px in most browsers. 1rem is 16 px, 1.5rem is 24 px. Sizes in rem follow the reader's font-size setting, which helps accessibility.
Why would the root size not be 16?
Some sites set html { font-size: 62.5% } so 1rem equals 10 px and the sums are easy. Enter that root size to get the right answer for your stylesheet.
What is the Tailwind class for a size?
Tailwind spacing steps are 4 px apart: p-4 is 16 px, p-6 is 24 px. The converter shows the step when your size matches one.
Should I use em instead?
em is relative to the font size of the parent element, so it compounds when nested. rem always refers to the root, which makes it more predictable for layout.
How do I use this px to rem converter tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Frontend & Design

View all Frontend & Design tools →