PX to REM Converter

REM (Root EM) is a unit of measurement used in web design and development to specify font size and other elements in relative terms. It is relative to the size of the root element, typically the HTML element.

Result:

Conversion options:

How to Use PX to REM Converter

  1. Enter base value (You can skip this step if your base font size is set to 16 PX.)
  2. Enter the value in PX that you want to convert

How to Convert PX to REM?

To convert pixels (px) to rem, you can use the following formula:

rem = px / base font-size

where the base font-size is typically set in the root element (HTML) of your document, and is usually 16px. So, for example, to convert 20px to rem:

rem = 20px / 16px = 1.25rem

This means that 20px is equal to 1.25 rem. You can adjust the base font-size to scale the entire design, and all rem units will be updated proportionally.

It's important to note that while rem provides more flexibility for responsive design, it may not be supported in older browsers. In these cases, you may want to consider using pixels or a mix of both units for maximum compatibility.

Is REM always 16px?

No, the default base font size for REM units is not always 16px. The base font size can be set in the CSS of a website, and it is typically set on the root element (HTML) of the document. The default font size is often 16px, but it can be set to any value, such as 14px, 18px, etc. It's up to the designer or developer to choose what base font size works best for their design.

When using REM units, it's important to keep in mind that changing the base font size will affect all elements specified in REM units, so it should be set thoughtfully and consistently throughout a website.

What difference Between PX and REM?

PX and REM are units of measurement used in web design and development to specify the size of elements on a website such as font size, margins, padding, etc.

The main difference between PX and REM is that:

  • PX is a fixed unit that represents a specific number of pixels on a screen, regardless of the screen size or resolution.
  • REM is a relative unit that is based on the font size of the root element (HTML) of a website. It is calculated as a proportion of the root font size, so if the root font size is changed, all elements specified in REM units will be resized proportionally.

So, PX is better suited for elements that need to maintain a specific size, while REM provides more flexibility for responsive design, allowing designers to create scalable and flexible designs that can adapt to different screen sizes and resolutions.

Ultimately, the choice between PX and REM will depend on the specific needs and goals of a website, and the designer or developer's preference and experience.

PX to REM Conversion Table

Here is a table showing the conversion of common pixel (px) values to rem units:

Pixels (px) REM
4px0.25rem
6px0.375rem
8px0.5rem
10px0.625rem
12px0.75rem
14px0.875rem
16px1rem
18px1.125rem
20px1.25rem
22px1.375rem
24px1.5rem
26px1.625rem
28px1.75rem
30px1.875rem
32px2rem
34px2.125rem
36px2.25rem
38px2.375rem
40px2.5rem
42px2.625rem
44px2.75rem
46px2.875rem
48px3rem
50px3.125rem
52px3.25rem
54px3.375rem
56px3.5rem
58px3.625rem
60px3.75rem
62px3.875rem
64px4rem
66px4.125rem
68px4.25rem
70px4.375rem
72px4.5rem
74px4.625rem
76px4.75rem
78px4.875rem
80px5rem
82px5.125rem
84px5.25rem

Note: The conversion of px to rem is based on the assumption that the base font size for the root element is 16px. If the base font size is different, the rem values in the table will also be different. To convert px to rem, you can use the formula: rem = px / base font-size.