CSS UNIT CONVERTER

PX to REM Converter

Convert pixels (px) to rem units quickly and accurately. Enter a pixel value and get the equivalent rem value based on your selected root font size.

PX → REM

Pixel to REM Converter

Enter your pixel value and root font size below.

px
px
RESULT 1rem 16px ÷ 16px = 1rem

What Is a PX to REM Converter?

A PX to REM converter helps you translate a pixel value into rem units for use in CSS. Pixels are commonly used when defining exact dimensions, while rem is a relative CSS unit that is based on the font size of the root HTML element.

This conversion is particularly useful when creating scalable typography, spacing systems, and responsive web layouts. Instead of calculating the conversion manually, you can enter your values above and get the result instantly.

The conversion depends on the root font size used by your website. A common browser and CSS setup uses a root font size of 16px, which means 16px equals 1rem.

How to Convert PX to REM

To convert pixels to rem, divide the pixel value by the root element's font size.

REM = PX ÷ Root Font Size

For example, if your root font size is 16px and you want to convert 32px:

32px ÷ 16px = 2rem

If your website uses a different root font size, the result will change accordingly. That's why the converter above allows you to enter your own root font size.

COMMON EXAMPLES
8px 0.5rem
16px 1rem
24px 1.5rem
32px 2rem
48px 3rem
64px 4rem

PX to REM Conversion Chart

The following values are based on a 16px root font size.

Pixels (PX) REM
1px0.0625rem
2px0.125rem
4px0.25rem
8px0.5rem
12px0.75rem
16px1rem
20px1.25rem
24px1.5rem
32px2rem
40px2.5rem
48px3rem
64px4rem
80px5rem
96px6rem
128px8rem

What Is REM in CSS?

REM stands for "root em." It is a relative CSS unit whose size is calculated from the font size of the root HTML element, represented by the html selector.

For example, if the root font size is 16px, then 1rem represents 16px. A value of 2rem represents 32px, while 0.5rem represents 8px.

html { font-size: 16px; } .example { font-size: 2rem; }

In this example, the element's font size would be equivalent to 32px when the root font size is 16px.

When Should You Use REM?

01

Typography

REM is commonly used for font sizes because values remain related to the root font size.

02

Spacing

Margins and padding can use rem to create a consistent and scalable spacing system.

03

Responsive Design

Relative units can make CSS values easier to scale when the root font size changes.

04

Accessible Interfaces

Using relative units can make designs more adaptable to changes in text sizing and user preferences.

PX vs REM: What's the Difference?

PX is an absolute CSS length unit, while REM is relative to the root element's font size. This difference makes them useful for different situations.

PX

  • Represents a fixed CSS length.
  • Useful when an exact pixel value is required.
  • Easy to understand and calculate.
  • Commonly used for precise visual dimensions.

REM

  • Relative to the root font size.
  • Useful for scalable typography and spacing.
  • Can help create consistent sizing systems.
  • Works well with responsive and accessible designs.

Frequently Asked Questions

Common questions about converting pixels to rem units.

How do I convert PX to REM?

Divide the pixel value by the root font size. For example, with a 16px root font size, 32px divided by 16px equals 2rem.

How many pixels are in 1 REM?

It depends on the root font size. With the common 16px root font size, 1rem equals 16px.

What is 32px in REM?

With a 16px root font size, 32px equals 2rem.

What is 24px in REM?

With a 16px root font size, 24px equals 1.5rem.

Does the root font size affect the conversion?

Yes. REM is based on the root element's font size. If the root font size changes, the PX to REM conversion changes as well.

Can I use REM for CSS spacing?

Yes. REM can be used for properties such as padding, margin, gaps, and font sizes when a scalable spacing system is appropriate for your design.

Need Another Conversion?

Explore all of our free pixel and CSS unit conversion tools.

View All Converters →