PX to REM Converter

To turn pixels into rem, divide the pixel value by the root font size. With the browser default of 16px, 24px is 1.5rem and 12px is 0.75rem. Type a value in either box to convert both ways, change the root size if your site uses another base, or paste whole CSS rules.

Common sizes at the default 16px root
PixelsremTypical use
12px0.75remCaptions, small labels
14px0.875remSecondary text, buttons
16px1remBody text
20px1.25remLarge body text, small headings
24px1.5remSection headings, card padding
32px2remPage headings, section gaps
48px3remHero headings

Updated

A two-way converter with a custom root size, a full table from 1 to 128 pixels with the matching Tailwind class, a converter for whole CSS blocks and a helper that writes fluid clamp() sizes.

Full px to rem table

px to rem at a 16px root, 1 to 128 pixels, with Tailwind classes
PixelsremTailwind spacingTailwind text
1px0.0625remp-px
2px0.125remp-0.5
3px0.1875remp-[0.1875rem]
4px0.25remp-1
5px0.3125remp-[0.3125rem]
6px0.375remp-1.5
7px0.4375remp-[0.4375rem]
8px0.5remp-2
9px0.5625remp-[0.5625rem]
10px0.625remp-2.5
11px0.6875remp-[0.6875rem]
12px0.75remp-3text-xs
13px0.8125remp-[0.8125rem]
14px0.875remp-3.5text-sm
15px0.9375remp-[0.9375rem]
16px1remp-4text-base
17px1.0625remp-[1.0625rem]
18px1.125remp-[1.125rem]text-lg
19px1.1875remp-[1.1875rem]
20px1.25remp-5text-xl
21px1.3125remp-[1.3125rem]
22px1.375remp-[1.375rem]
23px1.4375remp-[1.4375rem]
24px1.5remp-6text-2xl
25px1.5625remp-[1.5625rem]
26px1.625remp-[1.625rem]
27px1.6875remp-[1.6875rem]
28px1.75remp-7
29px1.8125remp-[1.8125rem]
30px1.875remp-[1.875rem]text-3xl
31px1.9375remp-[1.9375rem]
32px2remp-8
33px2.0625remp-[2.0625rem]
34px2.125remp-[2.125rem]
35px2.1875remp-[2.1875rem]
36px2.25remp-9text-4xl
37px2.3125remp-[2.3125rem]
38px2.375remp-[2.375rem]
39px2.4375remp-[2.4375rem]
40px2.5remp-10
41px2.5625remp-[2.5625rem]
42px2.625remp-[2.625rem]
43px2.6875remp-[2.6875rem]
44px2.75remp-11
45px2.8125remp-[2.8125rem]
46px2.875remp-[2.875rem]
47px2.9375remp-[2.9375rem]
48px3remp-12text-5xl
49px3.0625remp-[3.0625rem]
50px3.125remp-[3.125rem]
51px3.1875remp-[3.1875rem]
52px3.25remp-[3.25rem]
53px3.3125remp-[3.3125rem]
54px3.375remp-[3.375rem]
55px3.4375remp-[3.4375rem]
56px3.5remp-14
57px3.5625remp-[3.5625rem]
58px3.625remp-[3.625rem]
59px3.6875remp-[3.6875rem]
60px3.75remp-[3.75rem]text-6xl
61px3.8125remp-[3.8125rem]
62px3.875remp-[3.875rem]
63px3.9375remp-[3.9375rem]
64px4remp-16
65px4.0625remp-[4.0625rem]
66px4.125remp-[4.125rem]
67px4.1875remp-[4.1875rem]
68px4.25remp-[4.25rem]
69px4.3125remp-[4.3125rem]
70px4.375remp-[4.375rem]
71px4.4375remp-[4.4375rem]
72px4.5remp-[4.5rem]text-7xl
73px4.5625remp-[4.5625rem]
74px4.625remp-[4.625rem]
75px4.6875remp-[4.6875rem]
76px4.75remp-[4.75rem]
77px4.8125remp-[4.8125rem]
78px4.875remp-[4.875rem]
79px4.9375remp-[4.9375rem]
80px5remp-20
81px5.0625remp-[5.0625rem]
82px5.125remp-[5.125rem]
83px5.1875remp-[5.1875rem]
84px5.25remp-[5.25rem]
85px5.3125remp-[5.3125rem]
86px5.375remp-[5.375rem]
87px5.4375remp-[5.4375rem]
88px5.5remp-[5.5rem]
89px5.5625remp-[5.5625rem]
90px5.625remp-[5.625rem]
91px5.6875remp-[5.6875rem]
92px5.75remp-[5.75rem]
93px5.8125remp-[5.8125rem]
94px5.875remp-[5.875rem]
95px5.9375remp-[5.9375rem]
96px6remp-24text-8xl
97px6.0625remp-[6.0625rem]
98px6.125remp-[6.125rem]
99px6.1875remp-[6.1875rem]
100px6.25remp-[6.25rem]
101px6.3125remp-[6.3125rem]
102px6.375remp-[6.375rem]
103px6.4375remp-[6.4375rem]
104px6.5remp-[6.5rem]
105px6.5625remp-[6.5625rem]
106px6.625remp-[6.625rem]
107px6.6875remp-[6.6875rem]
108px6.75remp-[6.75rem]
109px6.8125remp-[6.8125rem]
110px6.875remp-[6.875rem]
111px6.9375remp-[6.9375rem]
112px7remp-28
113px7.0625remp-[7.0625rem]
114px7.125remp-[7.125rem]
115px7.1875remp-[7.1875rem]
116px7.25remp-[7.25rem]
117px7.3125remp-[7.3125rem]
118px7.375remp-[7.375rem]
119px7.4375remp-[7.4375rem]
120px7.5remp-[7.5rem]
121px7.5625remp-[7.5625rem]
122px7.625remp-[7.625rem]
123px7.6875remp-[7.6875rem]
124px7.75remp-[7.75rem]
125px7.8125remp-[7.8125rem]
126px7.875remp-[7.875rem]
127px7.9375remp-[7.9375rem]
128px8remp-32text-9xl

Why rem exists

Pixels in CSS are fixed units. A heading set to 32px stays 32px even when a visitor has told their browser to use larger text. The rem unit solves that by tying sizes to the root font size, which follows the visitor's setting by default. Change one number and every rem-based size on the page scales with it.

That makes rem a good fit for type, padding, margins and widths of text columns. Pixels still make sense for things that should not scale with text, such as a 1px divider or the size of an image whose pixel dimensions are fixed.

rem and em side by side

The live example on this page sets the same 1.25 size three levels deep, once in em and once in rem. The em version grows at each level because each child multiplies its parent's size. The rem version stays the same at every depth because it always looks back at the root.

em is still useful when something should scale with its own text, such as the padding inside a button or the gap after an icon. Set the button's font size in rem and its padding in em, and changing the font size resizes the whole button.

Fluid sizes with clamp()

clamp(min, preferred, max) picks the preferred value but never goes below the minimum or above the maximum. Using a mix of rem and vw for the preferred value makes a heading grow smoothly with the window width while still respecting the user's font size.

The helper works out the line between two points, for example 32px at a 375px wide phone and 56px at a 1280px desktop, and writes it as a rem plus vw expression. Test the result at a few widths, because very large vw slopes can make text grow faster than its line length.

How it works

  1. Set the root font size. Leave it at 16 unless your stylesheet sets a different size on the html element.
  2. Type into the pixel box to get rem, or into the rem box to get pixels. Both update as you type.
  3. Scroll the table to find any size from 1 to 128 pixels. Click a row to copy its rem value.
  4. Paste CSS into the block converter to switch every px value to rem at once. Zero becomes 0 and 1px borders stay in pixels unless you untick that option.
  5. Use the clamp() helper to get a font size that grows smoothly between a phone and a desktop width.

Tips

Frequently asked questions

How many pixels is 1rem?

1rem equals the font size of the root html element. Browsers default that to 16px, so 1rem is 16px unless the site or the visitor changes it. If a visitor sets their default text size to 20px, 1rem becomes 20px on any site that has not fixed the root size in pixels.

What is the difference between rem and em?

rem is always relative to the root html font size. em is relative to the font size of the element itself (or of its parent, when used on font-size). Nested em sizes multiply: a 1.2em list inside a 1.2em list ends up 1.44 times the base. rem never compounds, which is why most design systems use it.

Should I use px or rem for font sizes?

Use rem. Text set in px ignores the browser's default font size setting, which some people raise to read comfortably. Page zoom still works with px, but the font size preference does not, so rem is the more accessible choice.

How do Tailwind classes map to rem?

In Tailwind's default spacing scale, each step is 0.25rem, which is 4px at a 16px root. So p-4 is 1rem (16px) and gap-6 is 1.5rem (24px). Font sizes use names instead: text-sm is 0.875rem and text-base is 1rem. The table on this page lists the class for every size that is on the default scale.

Does this tool send my CSS anywhere?

No. Every conversion runs in your browser and nothing you type or paste is uploaded.

Related: Screen resolution and breakpoint checker, CSS grid generator, Font pairing tool, Color converter, All free tools.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Free Tools

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap