px ↔ rem Converter

WebToola

px ↔ rem Converter

Convert pixels and rem using an explicit root font size. This does not read or change your site’s styles.

Runs in your browser. This plugin does not send or save your inputs.

About the px ↔ rem Converter

The px ↔ rem Converter lets you quickly convert CSS values between pixels (px) and rem units using an explicit root font size.

Choose whether you want to convert pixels to rem or rem to pixels, enter your value and specify the root font size in pixels. The converter then calculates the equivalent value in the other unit.

The tool does not inspect your website or change any CSS styles. It performs the conversion using only the values you enter.

How to Convert PX to REM

To convert pixels to rem, select Pixels → rem, enter the pixel value, and specify the root font size.

The formula is:

rem = pixels ÷ root font size

For example, with:

Value: 16 px
Root font size: 16 px

The calculation is:

16 ÷ 16 = 1 rem

So:

16 px = 1 rem at a 16 px root font size.

As another example, 24 px with a 16 px root font size would be:

24 ÷ 16 = 1.5 rem

How to Convert REM to PX

To convert rem to pixels, select rem → pixels, enter the rem value, and specify the root font size.

The formula is:

pixels = rem × root font size

For example:

Value: 0.5 rem
Root font size: 12 px

The calculation is:

0.5 × 12 = 6 px

So:

0.5 rem = 6 px at a 12 px root font size.

If the root font size were 16 px instead, the same 0.5 rem value would equal 8 px. This demonstrates why specifying the correct root font size matters when converting between px and rem.

What Are PX and REM in CSS?

Pixels (px) are an absolute CSS length unit. A value such as 16px specifies a length of 16 CSS pixels.

REM stands for root em. A rem value is relative to the font size of the document’s root element, typically the <html> element.

For example, if the root font size is 16 px:

1 rem = 16 px
0.5 rem = 8 px
1.5 rem = 24 px
2 rem = 32 px

If the root font size changes, the pixel equivalent of a rem value changes as well.

Why Does Root Font Size Matter?

REM is a relative unit, so there is no universal pixel value for 1rem without knowing the root font size.

For example:

1 rem at 16 px root size = 16 px

but:

1 rem at 20 px root size = 20 px

A root font size of 16 px is a common browser default, but a website can define a different value. For accurate conversions, enter the root font size that applies to your design rather than assuming it is always 16 px.

WebToola does not read the root font size from your website. The converter uses the root font size you explicitly provide.

When to Use PX and REM

Pixels can be convenient when you need a specific CSS length, while rem units are useful when dimensions should scale relative to the document’s root font size.

Developers and designers commonly work with rem values for typography, spacing and other interface dimensions where relative sizing is useful.

This converter can help when translating design specifications expressed in pixels into rem-based CSS or when you need to determine the pixel equivalent of an existing rem value.

Frequently Asked Questions

How do I convert px to rem?

Divide the pixel value by the root font size in pixels.

For example, with a 16 px root font size:

24 px ÷ 16 px = 1.5 rem

How do I convert rem to px?

Multiply the rem value by the root font size.

For example, with a 16 px root font size:

1.5 rem × 16 px = 24 px

How many pixels are in 1 rem?

It depends on the root font size. If the root font size is 16 px, 1 rem equals 16 px. If the root font size is 20 px, 1 rem equals 20 px.

Is 1 rem always 16 px?

No. A 16 px root font size is common, but rem is relative to the actual root font size. If a site uses a different root font size, the pixel equivalent of 1 rem will be different.

What is 16 px in rem?

With a root font size of 16 px, 16 px equals 1 rem. With a different root font size, the result will change.

Does the converter detect my website’s root font size?

No. The converter does not read or modify your site’s styles. You explicitly enter the root font size that should be used for the conversion.

Does WebToola store the values I enter?

No. The px ↔ rem Converter runs in your browser and does not send or save the values you enter.